一、引言
在机器人运动的过程中,需要通过传感器感知周围物体的方位。由于传感器和机器人不在同一个坐标系中,所以需要坐标系的转换。在ROS中,直接封装了相关的模块:坐标转换(TF)
在ROS系统中,是通过右手坐标系标定物体的,如下图所示:
相对于tf,tf2更加简洁高效,常用的功能包有:
-
tf2_geometry_msgs:可以将ROS消息转换成tf2消息。
-
tf2: 封装了坐标变换的常用消息。
-
tf2_ros:为tf2提供了roscpp和rospy绑定,封装了坐标变换常用的API
二、坐标msg消息
2.1 常用msg
- geometry_msgs/TransformStamped:传输不同坐标系相关位置信息
std_msgs/Header header #头信息 uint32 seq #|-- 序列号 time stamp #|-- 时间戳 string frame_id #|-- 坐标 ID string child_frame_id #子坐标系的 id geometry_msgs/Transform transform #坐标信息 geometry_msgs/Vector3 translation #偏移量 float64 x #|-- X 方向的偏移量 float64 y #|-- Y 方向的偏移量 float64 z #|-- Z 方向上的偏移量 geometry_msgs/Quaternion rotation #四元数 float64 x float64 y float64 z float64 w
- geometry_msgs/PointStamped:传输某个坐标系内坐标点的信息
std_msgs/Header header #头 uint32 seq #|-- 序号 time stamp #|-- 时间戳 string frame_id #|-- 所属坐标系的 id geometry_msgs/Point point #点坐标 float64 x #|-- x y z 坐标 float64 y float64 z