34 #ifndef OPEN_WALKER_CORE_CONVERSIONS_H 35 #define OPEN_WALKER_CORE_CONVERSIONS_H 37 #include <Eigen/Dense> 39 #include <tf/LinearMath/Matrix3x3.h> 40 #include <tf/LinearMath/Quaternion.h> 41 #include <tf_conversions/tf_eigen.h> 43 #include <geometry_msgs/Quaternion.h> 44 #include <geometry_msgs/Point.h> 45 #include <geometry_msgs/Vector3.h> 69 template <
typename _Derived>
72 typedef typename Eigen::internal::traits<_Derived>::Scalar Scalar;
73 Eigen::Quaterniond ed;
75 e = ed.cast<Scalar>();
81 template <
typename _Derived>
84 typedef typename Eigen::internal::traits<_Derived>::Scalar Scalar;
85 typedef Eigen::Matrix<double, _Derived::ColsAtCompileTime, _Derived::RowsAtCompileTime> Base;
87 tf::matrixTFToEigen(t, ed);
88 e = ed.template cast<Scalar>();
99 template <
typename _Derived>
102 Eigen::Quaterniond ed;
104 quaterniondEigenToMatrixTF(ed, t);
110 template <
typename _Derived>
113 typedef Eigen::Matrix<double, _Derived::ColsAtCompileTime, _Derived::RowsAtCompileTime> Base;
115 ed = e.template cast<double>();
116 tf::matrixEigenToTF(ed, t);
122 template <
typename _Derived>
125 typedef typename Eigen::internal::traits<_Derived>::Scalar Scalar;
126 Eigen::Quaterniond ed;
127 tf::quaternionTFToEigen(t, ed);
128 e = ed.cast<Scalar>();
134 template <
typename _Derived>
137 typedef typename Eigen::internal::traits<_Derived>::Scalar Scalar;
138 Eigen::Quaternion<Scalar> eq;
140 e = eq.toRotationMatrix();
146 template <
typename _Derived>
150 Eigen::Quaterniond ed;
151 ed = e.template cast<double>();
152 tf::quaternionEigenToTF(ed, t);
155 template <
typename _Derived>
156 void matrixEigenToQuaternionTF(
const Eigen::MatrixBase<_Derived>& e, tf::Quaternion& t)
158 typedef typename Eigen::internal::traits<_Derived>::Scalar Scalar;
159 Eigen::Quaternion<Scalar> eq(e);
171 template <
typename _Derived>
174 typedef typename Eigen::internal::traits<_Derived>::Scalar Scalar;
175 Eigen::Quaterniond ed;
176 quaternionMsgToEigenQuaterniond(t, ed);
177 e = ed.cast<Scalar>();
183 template <
typename _Derived>
186 typedef typename Eigen::internal::traits<_Derived>::Scalar Scalar;
187 Eigen::Quaternion<Scalar> eq;
189 e = eq.toRotationMatrix();
200 template <
typename _Derived>
204 Eigen::Quaterniond ed;
205 ed = e.template cast<double>();
206 quaterniondEigenToQuaternionMsg(ed, t);
212 template <
typename _Derived>
215 typedef typename Eigen::internal::traits<_Derived>::Scalar Scalar;
216 Eigen::Quaternion<Scalar> eq(e);
228 template <
typename _Derived>
231 typedef Eigen::Matrix<double, _Derived::ColsAtCompileTime, _Derived::RowsAtCompileTime> Base;
232 Base ed = e.template cast<double>();
233 vector3dEigenToPointMsg(ed, t);
246 template <
typename _Derived>
249 typedef Eigen::Matrix<double, _Derived::ColsAtCompileTime, _Derived::RowsAtCompileTime> Base;
250 Base ed = e.template cast<double>();
251 vector3dEigenToVector3Msg(ed, t);
262 template <
typename _Derived>
265 typedef typename Eigen::MatrixBase<_Derived>::Scalar Scalar;
267 pointMsgToEigenVector3d(t, ed);
268 e = ed.cast<Scalar>();
279 template <
typename _Derived>
282 typedef typename Eigen::MatrixBase<_Derived>::Scalar Scalar;
284 vector3MsgToEigenVector3d(t, ed);
285 e = ed.cast<Scalar>();
291 template <
typename _Derived>
295 ed = e.template cast<double>();
296 tf::vectorEigenToTF(ed, t);
302 template <
typename _Derived>
305 typedef typename Eigen::MatrixBase<_Derived>::Scalar Scalar;
307 tf::vectorTFToEigen(t, ed);
308 e = ed.cast<Scalar>();
313 #endif // OPEN_WALKER_CORE_CONVERSIONS_H void quaternionEigenToQuaternionMsg(const Eigen::QuaternionBase< _Derived > &e, geometry_msgs::Quaternion &t)
Converts an Eigen::QuaternionBase to a geometry_msgs::Quaternion.
Definition: conversions.h:201
void vector3EigenToVector3TF(const Eigen::MatrixBase< _Derived > &e, tf::Vector3 &t)
Converts an Eigen::EigenBase into a tf::Vector3.
Definition: conversions.h:292
void vector3MsgToEigenVector3(const geometry_msgs::Vector3 &t, Eigen::MatrixBase< _Derived > &e)
Converts a geometry_msgs::Vector3 into an Eigen::EigenBase.
Definition: conversions.h:280
void quaternionEigenToMatrixTF(const Eigen::QuaternionBase< _Derived > &e, tf::Matrix3x3 &t)
Converts an Eigen::QuaternionBase into a tf::Matrix3x3.
Definition: conversions.h:100
void vector3EigenToVector3Msg(const Eigen::MatrixBase< _Derived > &e, geometry_msgs::Vector3 &t)
Converts an Eigen::EigenBase to a geometry_msgs::Point.
Definition: conversions.h:247
void pointMsgToEigenVector3d(const geometry_msgs::Point &t, Eigen::Vector3d &e)
Converts a geometry_msgs::Point into an Eigen::Vector3d.
void matrixTFToEigenMatrix(const tf::Matrix3x3 &t, Eigen::MatrixBase< _Derived > &e)
Converts a tf::Matrix3x3 into an Eigen::Matrix3.
Definition: conversions.h:82
void pointMsgToEigenVector3(const geometry_msgs::Point &t, Eigen::MatrixBase< _Derived > &e)
Converts a geometry_msgs::Point into an Eigen::EigenBase.
Definition: conversions.h:263
void matrixEigenToQuaternionMsg(const Eigen::MatrixBase< _Derived > &e, geometry_msgs::Quaternion &t)
Converts an Eigen::Matrix3 to a geometry_msgs::Quaternion.
Definition: conversions.h:213
void vector3EigenToPointMsg(const Eigen::MatrixBase< _Derived > &e, geometry_msgs::Point &t)
Converts an Eigen::EigenBase to a geometry_msgs::Point.
Definition: conversions.h:229
void quaternionMsgToEigenQuaternion(const geometry_msgs::Quaternion &t, Eigen::QuaternionBase< _Derived > &e)
Converts a geometry_msgs::Quaternion into an Eigen::QuaternionBase.
Definition: conversions.h:172
void quaterniondEigenToQuaternionMsg(const Eigen::Quaterniond &e, geometry_msgs::Quaternion &t)
Converts an Eigen::Quaterniond into a geometry_msgs::Quaternion.
void quaterniondEigenToMatrixTF(const Eigen::Quaterniond &e, tf::Matrix3x3 &t)
Converts an Eigen::Quaterniond into a tf::Matrix3x3.
void quaternionMsgToEigenMatrix(const geometry_msgs::Quaternion &t, Eigen::MatrixBase< _Derived > &e)
Converts a geometry_msgs::Quaternion into an Eigen::Matrix3.
Definition: conversions.h:184
Definition: angular_acceleration.h:39
void quaternionMsgToEigenQuaterniond(const geometry_msgs::Quaternion &t, Eigen::Quaterniond &e)
Converts a geometry_msgs::Quaternion into an Eigen::Quaterniond.
void matrixEigenToMatrixTF(const Eigen::MatrixBase< _Derived > &e, tf::Matrix3x3 &t)
Converts an Eigen::MatrixBase into a tf::Matrix3x3.
Definition: conversions.h:111
void quaternionTFToEigenQuaternion(const tf::Quaternion &t, Eigen::QuaternionBase< _Derived > &e)
Converts a tf::Quaternion into an Eigen::QuaternionBase.
Definition: conversions.h:123
void vector3MsgToEigenVector3d(const geometry_msgs::Vector3 &t, Eigen::Vector3d &e)
Converts a geometry_msgs::Vector3 into an Eigen::Vector3d.
void matrixTFToEigenQuaternion(const tf::Matrix3x3 &t, Eigen::QuaternionBase< _Derived > &e)
Converts a tf::Matrix3x3 into an Eigen::QuaternionBase.
Definition: conversions.h:70
void vector3dEigenToVector3Msg(const Eigen::Vector3d &e, geometry_msgs::Vector3 &t)
Converts an Eigen::Vector3d into a geometry_msgs::Point.
void vector3TFToVector3Eigen(const tf::Vector3 &t, Eigen::MatrixBase< _Derived > &e)
Converts an tf::Vector3 into Eigen::EigenBase.
Definition: conversions.h:303
void quaternionEigenToQuaternionTF(const Eigen::QuaternionBase< _Derived > &e, tf::Quaternion &t)
Converts a tf::Quaternion into an Eigen::QuaternionBase.
Definition: conversions.h:147
void matrixTFToEigenQuaterniond(const tf::Matrix3x3 &t, Eigen::Quaterniond &e)
Converts a tf::Matrix3x3 into an Eigen::Quaterniond.
void quaternionTFToEigenMatrix(const tf::Quaternion &t, Eigen::MatrixBase< _Derived > &e)
Converts a tf::Quaternion into an Eigen::MatrixBase.
Definition: conversions.h:135
void vector3dEigenToPointMsg(const Eigen::Vector3d &e, geometry_msgs::Point &t)
Converts an Eigen::Vector3d into a geometry_msgs::Point.