19 #ifndef MAV_PLANNING_MSGS_CONVERSIONS_H 20 #define MAV_PLANNING_MSGS_CONVERSIONS_H 22 #include <geometry_msgs/Point.h> 23 #include <geometry_msgs/Quaternion.h> 24 #include <geometry_msgs/Vector3.h> 26 #include "mav_planning_msgs/PolynomialSegment.h" 27 #include "mav_planning_msgs/PolynomialTrajectory.h" 38 *x = Eigen::Map<const Eigen::VectorXd>(&(array[0]), array.size());
43 PolynomialSegment::_x_type* array) {
44 array->resize(x.size());
45 Eigen::Map<Eigen::VectorXd> map =
46 Eigen::Map<Eigen::VectorXd>(&((*array)[0]), array->size());
53 assert(segment != NULL);
69 const PolynomialTrajectory& msg,
71 assert(eigen_trajectory != NULL);
72 eigen_trajectory->clear();
73 eigen_trajectory->reserve(msg.segments.size());
74 for (PolynomialTrajectory::_segments_type::const_iterator it =
76 it != msg.segments.end(); ++it) {
79 eigen_trajectory->push_back(segment);
86 PolynomialSegment* msg) {
104 PolynomialTrajectory* msg) {
106 msg->segments.reserve(eigen_trajectory.size());
107 for (EigenPolynomialTrajectory::const_iterator it = eigen_trajectory.begin();
108 it != eigen_trajectory.end(); ++it) {
109 PolynomialSegment segment;
111 msg->segments.push_back(segment);
117 #endif // MAV_PLANNING_MSGS_CONVERSIONS_H void polynomialTrajectoryMsgFromEigen(const EigenPolynomialTrajectory &eigen_trajectory, PolynomialTrajectory *msg)
void vectorFromMsgArray(const PolynomialSegment::_x_type &array, Eigen::VectorXd *x)
Converts a PolynomialSegment double array to an Eigen::VectorXd.
void eigenPolynomialSegmentFromMsg(const PolynomialSegment &msg, EigenPolynomialSegment *segment)
Converts a PolynomialSegment message to an EigenPolynomialSegment structure.
void eigenPolynomialTrajectoryFromMsg(const PolynomialTrajectory &msg, EigenPolynomialTrajectory *eigen_trajectory)
Converts a PolynomialTrajectory message to a EigenPolynomialTrajectory.
std::vector< EigenPolynomialSegment > EigenPolynomialTrajectory
void polynomialSegmentMsgFromEigen(const EigenPolynomialSegment &segment, PolynomialSegment *msg)
void msgArrayFromVector(const Eigen::VectorXd &x, PolynomialSegment::_x_type *array)
Converts an Eigen::VectorXd to a PolynomialSegment double array.