TF2 实现原理
ROS 核心模块:TF 与分布式通信。
Cite: tf,tf2完全理解
Source: geometry2
tf1/2消息类型:
#include "geometry_msgs/TransformStamped.h"
geometry_msgs::Vector3 vector;
geometry_msgs::Quaternion quaternion;
geometry_msgs::Transform transform;
geometry_msgs::Vector3Stamped stampedVector;
geometry_msgs::QuaternionStamped stampedQuaternion;
geometry_msgs::TransformStamped stampedTransformFull;
tf1 数据类型:
#include "tf/transform_datatypes.h"
tf::Vector3 vector;
tf::Quaternion quaternion;
tf::Transform transform;
tf::Stamped<tf::Vector3> stampedVector;
tf::Stamped<tf::Quaternion> stampedQuaternion;
tf::Stamped<tf::Transform> stampedTransform;
tf::StampedTransform stampedTransformFull;
tf1 辅助函数:
#include "tf/transform_datatypes.h"
tf::Quaternion quat_tf = tf::createQuaternionFromRPY(1.0, 0.0, 0.0);
geometry_msgs::Quaternion quat_msg = tf::createQuaternionMsgFromRollPitchYaw(1.0, 0.0, 0.0);
t2 数据类型:
#include "tf2/transform_datatypes.h"
tf::Vector3 vector;
tf::Quaternion quaternion;
tf::Transform transform;
tf2::Stamped<tf2::Vector3> stampedVector;
tf2::Stamped<tf2::Quaternion> stampedQuaternion;
tf2::Stamped<tf2::Transform> stampedTransform; // Please note that tf2::Stamped<tf2::Transform> has no child_frame_id field which is required within the ROS tf/tf2 framework.
// there's no TF2 counterpart of tf::StampedTransform
// tf2::StampedTransform stampedTransformFull;
tf2 辅助函数:
#include "tf2_geometry_msgs/tf2_geometry_msgs.h"
tf2::Quaternion quat_tf;
quat_tf.setRPY(1.0, 0.0, 0.0);
geometry_msgs::Quaternion quat_msg;
tf2::convert(quat_tf, quat_msg);