conversions.h
Go to the documentation of this file.
1 /*
2  * Copyright 2015 Fadri Furrer, ASL, ETH Zurich, Switzerland
3  * Copyright 2015 Michael Burri, ASL, ETH Zurich, Switzerland
4  * Copyright 2015 Markus Achtelik, ASL, ETH Zurich, Switzerland
5  * Copyright 2015 Helen Oleynikova, ASL, ETH Zurich, Switzerland
6  * Copyright 2015 Mina Kamel, ASL, ETH Zurich, Switzerland
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13 
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 // Conversion functions between Eigen types and MAV ROS message types.
22 
23 #ifndef MAV_MSGS_CONVERSIONS_H
24 #define MAV_MSGS_CONVERSIONS_H
25 
26 #include <geometry_msgs/Point.h>
27 #include <geometry_msgs/PoseStamped.h>
28 #include <geometry_msgs/Quaternion.h>
29 #include <geometry_msgs/TransformStamped.h>
30 #include <geometry_msgs/Vector3.h>
31 #include <nav_msgs/Odometry.h>
32 #include <ros/ros.h>
33 #include <trajectory_msgs/MultiDOFJointTrajectory.h>
34 
35 #include "mav_msgs/Actuators.h"
36 #include "mav_msgs/AttitudeThrust.h"
37 #include "mav_msgs/RateThrust.h"
38 #include "mav_msgs/RollPitchYawrateThrust.h"
39 #include "mav_msgs/TorqueThrust.h"
40 #include "mav_msgs/common.h"
43 
44 namespace mav_msgs {
45 
46 inline void eigenAttitudeThrustFromMsg(const AttitudeThrust& msg,
47  EigenAttitudeThrust* attitude_thrust) {
48  assert(attitude_thrust != NULL);
49 
50  attitude_thrust->attitude = quaternionFromMsg(msg.attitude);
51  attitude_thrust->thrust = vector3FromMsg(msg.thrust);
52 }
53 
54 inline void eigenActuatorsFromMsg(const Actuators& msg,
55  EigenActuators* actuators) {
56  assert(actuators != NULL);
57 
58  // Angle of the actuator in [rad].
59  actuators->angles.resize(msg.angles.size());
60  for (unsigned int i = 0; i < msg.angles.size(); ++i) {
61  actuators->angles[i] = msg.angles[i];
62  }
63 
64  // Angular velocities of the actuator in [rad/s].
65  actuators->angular_velocities.resize(msg.angular_velocities.size());
66  for (unsigned int i = 0; i < msg.angular_velocities.size(); ++i) {
67  actuators->angular_velocities[i] = msg.angular_velocities[i];
68  }
69 
70  // Normalized: Everything that does not fit the above, normalized
71  // between [-1 ... 1].
72  actuators->normalized.resize(msg.normalized.size());
73  for (unsigned int i = 0; i < msg.normalized.size(); ++i) {
74  actuators->normalized[i] = msg.normalized[i];
75  }
76 }
77 
78 inline void eigenRateThrustFromMsg(const RateThrust& msg,
79  EigenRateThrust* rate_thrust) {
80  assert(rate_thrust != NULL);
81 
82  rate_thrust->angular_rates = vector3FromMsg(msg.angular_rates);
83  rate_thrust->thrust = vector3FromMsg(msg.thrust);
84 }
85 
86 inline void eigenTorqueThrustFromMsg(const TorqueThrust& msg,
87  EigenTorqueThrust* torque_thrust) {
88  assert(torque_thrust != NULL);
89 
90  torque_thrust->torque = vector3FromMsg(msg.torque);
91  torque_thrust->thrust = vector3FromMsg(msg.thrust);
92 }
93 
95  const RollPitchYawrateThrust& msg,
96  EigenRollPitchYawrateThrust* roll_pitch_yawrate_thrust) {
97  assert(roll_pitch_yawrate_thrust != NULL);
98 
99  roll_pitch_yawrate_thrust->roll = msg.roll;
100  roll_pitch_yawrate_thrust->pitch = msg.pitch;
101  roll_pitch_yawrate_thrust->yaw_rate = msg.yaw_rate;
102  roll_pitch_yawrate_thrust->thrust = vector3FromMsg(msg.thrust);
103 }
104 
105 inline void eigenOdometryFromMsg(const nav_msgs::Odometry& msg,
106  EigenOdometry* odometry) {
107  assert(odometry != NULL);
108  odometry->timestamp_ns = msg.header.stamp.toNSec();
109  odometry->position_W = mav_msgs::vector3FromPointMsg(msg.pose.pose.position);
110  odometry->orientation_W_B =
111  mav_msgs::quaternionFromMsg(msg.pose.pose.orientation);
112  odometry->velocity_B = mav_msgs::vector3FromMsg(msg.twist.twist.linear);
113  odometry->angular_velocity_B =
114  mav_msgs::vector3FromMsg(msg.twist.twist.angular);
115  odometry->pose_covariance_ =
116  Eigen::Map<const Eigen::Matrix<double, 6, 6>>(msg.pose.covariance.data());
117  odometry->twist_covariance_ = Eigen::Map<const Eigen::Matrix<double, 6, 6>>(
118  msg.twist.covariance.data());
119 }
120 
122  const geometry_msgs::TransformStamped& msg,
123  EigenTrajectoryPoint* trajectory_point) {
124  assert(trajectory_point != NULL);
125 
126  ros::Time timestamp = msg.header.stamp;
127 
128  trajectory_point->timestamp_ns = timestamp.toNSec();
129  trajectory_point->position_W = vector3FromMsg(msg.transform.translation);
130  trajectory_point->orientation_W_B = quaternionFromMsg(msg.transform.rotation);
131  trajectory_point->velocity_W.setZero();
132  trajectory_point->angular_velocity_W.setZero();
133  trajectory_point->acceleration_W.setZero();
134  trajectory_point->angular_acceleration_W.setZero();
135  trajectory_point->jerk_W.setZero();
136  trajectory_point->snap_W.setZero();
137 }
138 
139 // 2 versions of this: one for PoseStamped (which fills in the timestamps
140 // correctly and should be used if at all possible), and one for a raw pose
141 // message.
143  const geometry_msgs::Pose& msg, EigenTrajectoryPoint* trajectory_point) {
144  assert(trajectory_point != NULL);
145 
146  trajectory_point->position_W = vector3FromPointMsg(msg.position);
147  trajectory_point->orientation_W_B = quaternionFromMsg(msg.orientation);
148  trajectory_point->velocity_W.setZero();
149  trajectory_point->angular_velocity_W.setZero();
150  trajectory_point->acceleration_W.setZero();
151  trajectory_point->angular_acceleration_W.setZero();
152  trajectory_point->jerk_W.setZero();
153  trajectory_point->snap_W.setZero();
154 }
155 
157  const geometry_msgs::PoseStamped& msg,
158  EigenTrajectoryPoint* trajectory_point) {
159  assert(trajectory_point != NULL);
160 
161  ros::Time timestamp = msg.header.stamp;
162 
163  trajectory_point->timestamp_ns = timestamp.toNSec();
164  eigenTrajectoryPointFromPoseMsg(msg.pose, trajectory_point);
165 }
166 
190  const Eigen::Vector3d& acceleration, const Eigen::Vector3d& jerk,
191  const Eigen::Vector3d& snap, double yaw, double yaw_rate,
192  double yaw_acceleration, double magnitude_of_gravity,
193  Eigen::Quaterniond* orientation, Eigen::Vector3d* acceleration_body,
194  Eigen::Vector3d* angular_velocity_body,
195  Eigen::Vector3d* angular_acceleration_body);
196 
200  const Eigen::Vector3d& acceleration, const Eigen::Vector3d& jerk,
201  const Eigen::Vector3d& snap, double yaw, double yaw_rate,
202  double yaw_acceleration, Eigen::Quaterniond* orientation,
203  Eigen::Vector3d* acceleration_body, Eigen::Vector3d* angular_velocity_body,
204  Eigen::Vector3d* angular_acceleration_body) {
206  acceleration, jerk, snap, yaw, yaw_rate, yaw_acceleration, kGravity,
207  orientation, acceleration_body, angular_velocity_body,
208  angular_acceleration_body);
209 }
210 
214  const EigenTrajectoryPoint& trajectory_point, double magnitude_of_gravity,
215  EigenMavState* mav_state) {
216  assert(mav_state != NULL);
217  if (trajectory_point.degrees_of_freedom == MavActuation::DOF4) {
219  trajectory_point.acceleration_W, trajectory_point.jerk_W,
220  trajectory_point.snap_W, trajectory_point.getYaw(),
221  trajectory_point.getYawRate(), trajectory_point.getYawAcc(),
222  magnitude_of_gravity, &(mav_state->orientation_W_B),
223  &(mav_state->acceleration_B), &(mav_state->angular_velocity_B),
224  &(mav_state->angular_acceleration_B));
225  mav_state->position_W = trajectory_point.position_W;
226  mav_state->velocity_W = trajectory_point.velocity_W;
227  } else {
228  // Assume fully actuated vehicle, can track trajectory point.
229  Eigen::Matrix3d R = trajectory_point.orientation_W_B.toRotationMatrix();
230  mav_state->position_W = trajectory_point.position_W;
231  mav_state->velocity_W = trajectory_point.velocity_W;
232  mav_state->acceleration_B =
233  R.transpose() * (trajectory_point.acceleration_W +
234  Eigen::Vector3d(0.0, 0.0, magnitude_of_gravity));
235  mav_state->orientation_W_B = trajectory_point.orientation_W_B;
236  mav_state->angular_velocity_B =
237  R.transpose() * trajectory_point.angular_velocity_W;
238  mav_state->angular_acceleration_B =
239  R.transpose() * trajectory_point.angular_acceleration_W;
240  }
241 }
242 
249  const EigenTrajectoryPoint& flat_state, EigenMavState* mav_state) {
250  EigenMavStateFromEigenTrajectoryPoint(flat_state, kGravity, mav_state);
251 }
252 
254  const Eigen::Vector3d& acceleration, const Eigen::Vector3d& jerk,
255  const Eigen::Vector3d& snap, double yaw, double yaw_rate,
256  double yaw_acceleration, double magnitude_of_gravity,
257  Eigen::Quaterniond* orientation, Eigen::Vector3d* acceleration_body,
258  Eigen::Vector3d* angular_velocity_body,
259  Eigen::Vector3d* angular_acceleration_body) {
260  // Mapping from flat state to full state following to Mellinger [1]:
261  // See [1]: Mellinger, Daniel Warren. "Trajectory generation and control for
262  // quadrotors." (2012), Phd-thesis, p. 15ff.
263  // http://repository.upenn.edu/cgi/viewcontent.cgi?article=1705&context=edissertations
264  //
265  // zb = acc+[0 0 magnitude_of_gravity]';
266  // thrust = norm(zb);
267  // zb = zb / thrust;
268  //
269  // xc = [cos(yaw) sin(yaw) 0]';
270  //
271  // yb = cross(zb, xc);
272  // yb = yb/norm(yb);
273  //
274  // xb = cross(yb, zb);
275  //
276  // q(:,i) = rot2quat([xb yb zb]);
277  //
278  // h_w = 1/thrust*(acc_dot - zb' * acc_dot * zb;
279  //
280  // w(1,i) = -h_w'*yb;
281  // w(2,i) = h_w'*xb;
282  // w(3,i) = yaw_dot*[0 0 1]*zb;
283 
284  assert(orientation != nullptr);
285  assert(acceleration_body != nullptr);
286  assert(angular_velocity_body != nullptr);
287  assert(angular_acceleration_body != nullptr);
288 
289  Eigen::Vector3d xb;
290  Eigen::Vector3d yb;
291  Eigen::Vector3d zb(acceleration);
292 
293  zb[2] += magnitude_of_gravity;
294  const double thrust = zb.norm();
295  const double inv_thrust = 1.0 / thrust;
296  zb = zb * inv_thrust;
297 
298  yb = zb.cross(Eigen::Vector3d(cos(yaw), sin(yaw), 0.0));
299  yb.normalize();
300 
301  xb = yb.cross(zb);
302 
303  const Eigen::Matrix3d R((Eigen::Matrix3d() << xb, yb, zb).finished());
304 
305  const Eigen::Vector3d h_w =
306  inv_thrust * (jerk - double(zb.transpose() * jerk) * zb);
307 
308  *orientation = Eigen::Quaterniond(R);
309  *acceleration_body = R.transpose() * zb * thrust;
310  (*angular_velocity_body)[0] = -h_w.transpose() * yb;
311  (*angular_velocity_body)[1] = h_w.transpose() * xb;
312  (*angular_velocity_body)[2] = yaw_rate * zb[2];
313 
314  // Calculate angular accelerations.
315  const Eigen::Vector3d wcrossz = (*angular_velocity_body).cross(zb);
316  const Eigen::Vector3d wcrosswcrossz = (*angular_velocity_body).cross(wcrossz);
317  const Eigen::Vector3d h_a =
318  inv_thrust * (snap - double(zb.transpose() * snap) * zb) - 2 * wcrossz -
319  wcrosswcrossz + double(zb.transpose() * wcrosswcrossz) * zb;
320 
321  (*angular_acceleration_body)[0] = -h_a.transpose() * yb;
322  (*angular_acceleration_body)[1] = h_a.transpose() * xb;
323  (*angular_acceleration_body)[2] = yaw_acceleration * zb[2];
324 }
325 
327  const trajectory_msgs::MultiDOFJointTrajectoryPoint& msg,
328  EigenTrajectoryPoint* trajectory_point) {
329  assert(trajectory_point != NULL);
330 
331  if (msg.transforms.empty()) {
332  ROS_ERROR("MultiDofJointTrajectoryPoint is empty.");
333  return;
334  }
335 
336  if (msg.transforms.size() > 1) {
337  ROS_WARN(
338  "MultiDofJointTrajectoryPoint message should have one joint, but has "
339  "%lu. Using first joint.",
340  msg.transforms.size());
341  }
342 
343  trajectory_point->time_from_start_ns = msg.time_from_start.toNSec();
344  trajectory_point->position_W = vector3FromMsg(msg.transforms[0].translation);
345  trajectory_point->orientation_W_B =
346  quaternionFromMsg(msg.transforms[0].rotation);
347  if (msg.velocities.size() > 0) {
348  trajectory_point->velocity_W = vector3FromMsg(msg.velocities[0].linear);
349  trajectory_point->angular_velocity_W =
350  vector3FromMsg(msg.velocities[0].angular);
351  } else {
352  trajectory_point->velocity_W.setZero();
353  trajectory_point->angular_velocity_W.setZero();
354  }
355  if (msg.accelerations.size() > 0) {
356  trajectory_point->acceleration_W =
357  vector3FromMsg(msg.accelerations[0].linear);
358  trajectory_point->angular_acceleration_W =
359  vector3FromMsg(msg.accelerations[0].angular);
360  } else {
361  trajectory_point->acceleration_W.setZero();
362  trajectory_point->angular_acceleration_W.setZero();
363  }
364  trajectory_point->jerk_W.setZero();
365  trajectory_point->snap_W.setZero();
366 }
367 
369  const trajectory_msgs::MultiDOFJointTrajectory& msg,
370  EigenTrajectoryPointVector* trajectory) {
371  assert(trajectory != NULL);
372  trajectory->clear();
373  for (const auto& msg_point : msg.points) {
374  EigenTrajectoryPoint point;
375  eigenTrajectoryPointFromMsg(msg_point, &point);
376  trajectory->push_back(point);
377  }
378 }
379 
381  const trajectory_msgs::MultiDOFJointTrajectory& msg,
382  EigenTrajectoryPointDeque* trajectory) {
383  assert(trajectory != NULL);
384  trajectory->clear();
385  for (const auto& msg_point : msg.points) {
386  EigenTrajectoryPoint point;
387  eigenTrajectoryPointFromMsg(msg_point, &point);
388  trajectory->push_back(point);
389  }
390 }
391 
392 // In all these conversions, client is responsible for filling in message
393 // header.
394 inline void msgActuatorsFromEigen(const EigenActuators& actuators,
395  Actuators* msg) {
396  assert(msg != NULL);
397 
398  msg->angles.resize(actuators.angles.size());
399  for (unsigned int i = 0; i < actuators.angles.size(); ++i) {
400  msg->angles[i] = actuators.angles[i];
401  }
402 
403  msg->angular_velocities.resize(actuators.angular_velocities.size());
404  for (unsigned int i = 0; i < actuators.angular_velocities.size(); ++i) {
405  msg->angular_velocities[i] = actuators.angular_velocities[i];
406  }
407 
408  msg->normalized.resize(actuators.normalized.size());
409  for (unsigned int i = 0; i < actuators.normalized.size(); ++i) {
410  msg->normalized[i] = actuators.normalized[i];
411  }
412 }
413 
415  const EigenAttitudeThrust& attitude_thrust, AttitudeThrust* msg) {
416  assert(msg != NULL);
417  quaternionEigenToMsg(attitude_thrust.attitude, &msg->attitude);
418  vectorEigenToMsg(attitude_thrust.thrust, &msg->thrust);
419 }
420 
421 inline void msgRateThrustFromEigen(EigenRateThrust& rate_thrust,
422  RateThrust* msg) {
423  assert(msg != NULL);
424  vectorEigenToMsg(rate_thrust.angular_rates, &msg->angular_rates);
425  vectorEigenToMsg(rate_thrust.thrust, &msg->thrust);
426 }
427 
428 inline void msgTorqueThrustFromEigen(EigenTorqueThrust& torque_thrust,
429  TorqueThrust* msg) {
430  assert(msg != NULL);
431  vectorEigenToMsg(torque_thrust.torque, &msg->torque);
432  vectorEigenToMsg(torque_thrust.thrust, &msg->thrust);
433 }
434 
436  const EigenRollPitchYawrateThrust& roll_pitch_yawrate_thrust,
437  RollPitchYawrateThrust* msg) {
438  assert(msg != NULL);
439  msg->roll = roll_pitch_yawrate_thrust.roll;
440  msg->pitch = roll_pitch_yawrate_thrust.pitch;
441  msg->yaw_rate = roll_pitch_yawrate_thrust.yaw_rate;
442  vectorEigenToMsg(roll_pitch_yawrate_thrust.thrust, &msg->thrust);
443 }
444 
445 inline void msgOdometryFromEigen(const EigenOdometry& odometry,
446  nav_msgs::Odometry* msg) {
447  assert(msg != NULL);
448 
449  if (odometry.timestamp_ns >= 0) {
450  msg->header.stamp.fromNSec(odometry.timestamp_ns);
451  }
452  pointEigenToMsg(odometry.position_W, &msg->pose.pose.position);
453  quaternionEigenToMsg(odometry.orientation_W_B, &msg->pose.pose.orientation);
454 
455  vectorEigenToMsg(odometry.velocity_B, &msg->twist.twist.linear);
456  vectorEigenToMsg(odometry.angular_velocity_B, &msg->twist.twist.angular);
457 }
458 
459 // WARNING: discards all derivatives, etc.
461  const EigenTrajectoryPoint& trajectory_point,
462  geometry_msgs::PoseStamped* msg) {
463  if (trajectory_point.timestamp_ns >= 0) {
464  msg->header.stamp.fromNSec(trajectory_point.timestamp_ns);
465  }
466  pointEigenToMsg(trajectory_point.position_W, &msg->pose.position);
467  quaternionEigenToMsg(trajectory_point.orientation_W_B,
468  &msg->pose.orientation);
469 }
470 
472  const EigenTrajectoryPoint& trajectory_point,
473  trajectory_msgs::MultiDOFJointTrajectoryPoint* msg) {
474  assert(msg != NULL);
475 
476  msg->time_from_start.fromNSec(trajectory_point.time_from_start_ns);
477  msg->transforms.resize(1);
478  msg->velocities.resize(1);
479  msg->accelerations.resize(1);
480 
481  vectorEigenToMsg(trajectory_point.position_W,
482  &msg->transforms[0].translation);
483  quaternionEigenToMsg(trajectory_point.orientation_W_B,
484  &msg->transforms[0].rotation);
485  vectorEigenToMsg(trajectory_point.velocity_W, &msg->velocities[0].linear);
486  vectorEigenToMsg(trajectory_point.angular_velocity_W,
487  &msg->velocities[0].angular);
488  vectorEigenToMsg(trajectory_point.acceleration_W,
489  &msg->accelerations[0].linear);
490  vectorEigenToMsg(trajectory_point.angular_acceleration_W,
491  &msg->accelerations[0].angular);
492 }
493 
495  const EigenTrajectoryPoint& trajectory_point, const std::string& link_name,
496  trajectory_msgs::MultiDOFJointTrajectory* msg) {
497  assert(msg != NULL);
498  trajectory_msgs::MultiDOFJointTrajectoryPoint point_msg;
499  msgMultiDofJointTrajectoryPointFromEigen(trajectory_point, &point_msg);
500 
501  msg->joint_names.clear();
502  msg->points.clear();
503  msg->joint_names.push_back(link_name);
504  msg->points.push_back(point_msg);
505 }
506 
508  const EigenTrajectoryPoint& trajectory_point,
509  trajectory_msgs::MultiDOFJointTrajectory* msg) {
510  msgMultiDofJointTrajectoryFromEigen(trajectory_point, "base_link", msg);
511 }
512 
513 // Convenience method to quickly create a trajectory from a single waypoint.
515  const Eigen::Vector3d& position, double yaw,
516  trajectory_msgs::MultiDOFJointTrajectory* msg) {
517  assert(msg != NULL);
518 
519  EigenTrajectoryPoint point;
520  point.position_W = position;
521  point.setFromYaw(yaw);
522 
524 }
525 
527  const EigenTrajectoryPointVector& trajectory, const std::string& link_name,
528  trajectory_msgs::MultiDOFJointTrajectory* msg) {
529  assert(msg != NULL);
530 
531  if (trajectory.empty()) {
532  ROS_ERROR("EigenTrajectoryPointVector is empty.");
533  return;
534  }
535 
536  msg->joint_names.clear();
537  msg->joint_names.push_back(link_name);
538  msg->points.clear();
539 
540  for (const auto& trajectory_point : trajectory) {
541  trajectory_msgs::MultiDOFJointTrajectoryPoint point_msg;
542  msgMultiDofJointTrajectoryPointFromEigen(trajectory_point, &point_msg);
543  msg->points.push_back(point_msg);
544  }
545 }
546 
548  const EigenTrajectoryPointVector& trajectory,
549  trajectory_msgs::MultiDOFJointTrajectory* msg) {
550  msgMultiDofJointTrajectoryFromEigen(trajectory, "base_link", msg);
551 }
552 
554  const EigenTrajectoryPointDeque& trajectory, const std::string& link_name,
555  trajectory_msgs::MultiDOFJointTrajectory* msg) {
556  assert(msg != NULL);
557 
558  if (trajectory.empty()) {
559  ROS_ERROR("EigenTrajectoryPointVector is empty.");
560  return;
561  }
562 
563  msg->joint_names.clear();
564  msg->joint_names.push_back(link_name);
565  msg->points.clear();
566 
567  for (const auto& trajectory_point : trajectory) {
568  trajectory_msgs::MultiDOFJointTrajectoryPoint point_msg;
569  msgMultiDofJointTrajectoryPointFromEigen(trajectory_point, &point_msg);
570  msg->points.push_back(point_msg);
571  }
572 }
573 
575  const EigenTrajectoryPointDeque& trajectory,
576  trajectory_msgs::MultiDOFJointTrajectory* msg) {
577  msgMultiDofJointTrajectoryFromEigen(trajectory, "base_link", msg);
578 }
579 
580 } // end namespace mav_msgs
581 
582 #endif // MAV_MSGS_CONVERSIONS_H
void quaternionEigenToMsg(const Eigen::Quaterniond &eigen, geometry_msgs::Quaternion *msg)
Definition: common.h:92
const double kGravity
void eigenTrajectoryPointFromMsg(const trajectory_msgs::MultiDOFJointTrajectoryPoint &msg, EigenTrajectoryPoint *trajectory_point)
Definition: conversions.h:326
void eigenTrajectoryPointDequeFromMsg(const trajectory_msgs::MultiDOFJointTrajectory &msg, EigenTrajectoryPointDeque *trajectory)
Definition: conversions.h:380
void msgOdometryFromEigen(const EigenOdometry &odometry, nav_msgs::Odometry *msg)
Definition: conversions.h:445
Eigen::VectorXd normalized
Eigen::Vector3d position_W
EIGEN_MAKE_ALIGNED_OPERATOR_NEW int64_t timestamp_ns
void msgRollPitchYawrateThrustFromEigen(const EigenRollPitchYawrateThrust &roll_pitch_yawrate_thrust, RollPitchYawrateThrust *msg)
Definition: conversions.h:435
Eigen::Vector3d vector3FromMsg(const geometry_msgs::Vector3 &msg)
Definition: common.h:55
Eigen::Vector3d velocity_B
void msgMultiDofJointTrajectoryPointFromEigen(const EigenTrajectoryPoint &trajectory_point, trajectory_msgs::MultiDOFJointTrajectoryPoint *msg)
Definition: conversions.h:471
Eigen::Matrix< double, 6, 6 > twist_covariance_
void msgMultiDofJointTrajectoryFromEigen(const EigenTrajectoryPoint &trajectory_point, const std::string &link_name, trajectory_msgs::MultiDOFJointTrajectory *msg)
Definition: conversions.h:494
Eigen::Matrix< double, 6, 6 > pose_covariance_
Eigen::Quaterniond orientation_W_B
uint64_t toNSec() const
void EigenMavStateFromEigenTrajectoryPoint(const Eigen::Vector3d &acceleration, const Eigen::Vector3d &jerk, const Eigen::Vector3d &snap, double yaw, double yaw_rate, double yaw_acceleration, double magnitude_of_gravity, Eigen::Quaterniond *orientation, Eigen::Vector3d *acceleration_body, Eigen::Vector3d *angular_velocity_body, Eigen::Vector3d *angular_acceleration_body)
Computes the MAV state (position, velocity, attitude, angular velocity, angular acceleration) from th...
Definition: conversions.h:253
EIGEN_MAKE_ALIGNED_OPERATOR_NEW Eigen::Vector3d angular_rates
void eigenOdometryFromMsg(const nav_msgs::Odometry &msg, EigenOdometry *odometry)
Definition: conversions.h:105
void eigenTrajectoryPointFromPoseMsg(const geometry_msgs::Pose &msg, EigenTrajectoryPoint *trajectory_point)
Definition: conversions.h:142
Eigen::VectorXd angular_velocities
void eigenTrajectoryPointVectorFromMsg(const trajectory_msgs::MultiDOFJointTrajectory &msg, EigenTrajectoryPointVector *trajectory)
Definition: conversions.h:368
EIGEN_MAKE_ALIGNED_OPERATOR_NEW int64_t timestamp_ns
EIGEN_MAKE_ALIGNED_OPERATOR_NEW Eigen::VectorXd angles
void eigenAttitudeThrustFromMsg(const AttitudeThrust &msg, EigenAttitudeThrust *attitude_thrust)
Definition: conversions.h:46
Eigen::Quaterniond orientation_W_B
Eigen::Vector3d position_W
void msgPoseStampedFromEigenTrajectoryPoint(const EigenTrajectoryPoint &trajectory_point, geometry_msgs::PoseStamped *msg)
Definition: conversions.h:460
Eigen::Vector3d angular_acceleration_B
void eigenTrajectoryPointFromTransformMsg(const geometry_msgs::TransformStamped &msg, EigenTrajectoryPoint *trajectory_point)
Definition: conversions.h:121
void eigenRateThrustFromMsg(const RateThrust &msg, EigenRateThrust *rate_thrust)
Definition: conversions.h:78
void msgTorqueThrustFromEigen(EigenTorqueThrust &torque_thrust, TorqueThrust *msg)
Definition: conversions.h:428
void eigenActuatorsFromMsg(const Actuators &msg, EigenActuators *actuators)
Definition: conversions.h:54
EIGEN_MAKE_ALIGNED_OPERATOR_NEW Eigen::Quaterniond attitude
void vectorEigenToMsg(const Eigen::Vector3d &eigen, geometry_msgs::Vector3 *msg)
Definition: common.h:76
Container holding the state of a MAV: position, velocity, attitude and angular velocity. In addition, holds the acceleration expressed in body coordinates, which is what the accelerometer usually measures.
void msgMultiDofJointTrajectoryFromPositionYaw(const Eigen::Vector3d &position, double yaw, trajectory_msgs::MultiDOFJointTrajectory *msg)
Definition: conversions.h:514
Eigen::Vector3d angular_velocity_B
Eigen::Vector3d angular_acceleration_W
Eigen::Quaterniond quaternionFromMsg(const geometry_msgs::Quaternion &msg)
Definition: common.h:63
Eigen::Quaterniond orientation_W_B
Eigen::Vector3d vector3FromPointMsg(const geometry_msgs::Point &msg)
Definition: common.h:59
void msgAttitudeThrustFromEigen(const EigenAttitudeThrust &attitude_thrust, AttitudeThrust *msg)
Definition: conversions.h:414
EIGEN_MAKE_ALIGNED_OPERATOR_NEW Eigen::Vector3d torque
void eigenTorqueThrustFromMsg(const TorqueThrust &msg, EigenTorqueThrust *torque_thrust)
Definition: conversions.h:86
Eigen::Vector3d velocity_W
void eigenRollPitchYawrateThrustFromMsg(const RollPitchYawrateThrust &msg, EigenRollPitchYawrateThrust *roll_pitch_yawrate_thrust)
Definition: conversions.h:94
Eigen::Vector3d angular_velocity_B
void pointEigenToMsg(const Eigen::Vector3d &eigen, geometry_msgs::Point *msg)
Definition: common.h:84
Eigen::Vector3d acceleration_B
void msgRateThrustFromEigen(EigenRateThrust &rate_thrust, RateThrust *msg)
Definition: conversions.h:421
void msgActuatorsFromEigen(const EigenActuators &actuators, Actuators *msg)
Definition: conversions.h:394


mav_msgs
Author(s): Simon Lynen, Markus Achtelik, Pascal Gohl, Sammy Omari, Michael Burri, Fadri Furrer, Helen Oleynikova, Mina Kamel, Karen Bodie, Rik Bähnemann
autogenerated on Thu Jan 23 2020 03:14:00