static_transform-publisher的功能是发布两个坐标系之间的静态坐标变换,这两个坐标系不会发生相对位置变化。命令格式为:
$ static_transform_publisher x y z yaw pitch roll frame_id child_frame_id period_im_ms
$ static_transform_publisher x y z qx qy qz qx frame_id child_frame_id period_im_ms
一种是使用俯仰角作为旋转参数,一种是使用四元数作为旋转参数
在ROS中使用很方便 只需要编写一段launch文件即可
<launch>
<node pkg ="tf" type="static_transform_publisher" name="link1"
args="0 0 0 0 0 0 link1_parent link1 100" />
</launch>
举例 我们可以运行一个小海龟的demo
roslaunch turtle_tf turtle_tf_demo.launch
接着打开rviz 插入tf后,可以看到三个坐标系都在rviz中显示了,分别是world、turtle1和turtle2
我们编写一段launch文件 加入一个坐标系 (相对于world永远静止)
<launch>
<node pkg="tf" type="static_transform_publisher" name="Juedui_Link"
args="2 3 0 0 0 0 world Juedui_Link 100" />
</launch>
启动launch文件,可以看到新的坐标已经生成了
rviz中又出现了一个新的坐标,与world之间的相对关系,可以通过不断的调试来确定,非常的方便快捷了!