tf之static_transform_publisher

tf:transform,ROS中管理3D坐标系变换的工具。只要告诉tf两个相关联坐标系的坐标变换信息,tf会帮你一直记录这个两个坐标系的坐标变换,即使两个坐标系处于运动中。

1 tf的命令行用法有以下6种:

view_frames: visualizes the full tree of coordinate transforms. 打印当前tf图形化信息,树状结构。
tf_monitor: monitors transforms between frames. 起监控作用,可以在ROS_CONSOLE中打印出两个坐标系的延迟信息,以及每个坐标系是由哪个节点发布的。
tf_echo: prints specified transform to screen。类似于rostopic echo,打印当前的tf信息
roswtf: with the tfwtf plugin, helps you track down problems with tf.  找错的
static_transform_publisher is a command line tool for sending static transforms. 静态发布一个从父坐标系到子坐标系的一个坐标变换。这个用的非常频繁!

2 static_transform_publisher

接下来主要介绍下static_transform_publisher,因为这个用的最频繁。

2.1 yaw pitch roll


这是Eular的wiki中的原图,以飞机为例。
  • yaw 控制飞机方向,故称为偏航角
  • pitch 控制飞机俯仰角度,故称为俯仰
  • roll 控制飞机横滚,故称为横滚 (中文名称为经验之谈,可能不准确!!!)
这三个词同样可以应用在坐标系中。 
yaw代表这绕z轴旋转的角度,pitch代表绕Y轴的角度,roll代表绕X轴的角度。

2.2 用法解释

wiki.ros.org 中的原文说到:


static_transform_publisher x y z yaw pitch roll frame_id child_frame_id period_in_ms
  • Publish a static coordinate transform to tf using an x/y/z offset in meters and yaw/pitch/roll in radians. (yaw is rotation about Z, pitch is rotation about Y, and roll is rotation about X). The period, in milliseconds, specifies how often to send a transform. 100ms (10hz) is a good value.
static_transform_publisher x y z qx qy qz qw frame_id child_frame_id  period_in_ms
  • Publish a static coordinate transform to tf using an x/y/z offset in meters and quaternion. The period, in milliseconds, specifies how often to send a transform. 100ms (10hz) is a good value.

static_transform_publisher is designed both as a command-line tool for manual use, as well as for use within roslaunch files for setting static transforms. For example:


<launch>
  <node pkg="tf" type="static_transform_publisher" name="link1_broadcaster" args="1 0 0 0 0 0 1 link1_parent link1 100" />
</launch>


从中可以看出static_transform_publisher有两种发布方式,一种是发布yaw pitch roll,一种是发布四元数。而且用法既可以通过命令行形式敲命令,也可以写进launch文件中启动。

值得一提的是:这个命令是发布静态坐标变换的,只能发布两个静止的坐标系间的坐标变换,而且,它是将坐标变换发布到tf中,剩下的由tf进行操作。

参数解释:

1 前边的x y z分别代表着相应轴的平移,单位是 米 。
2 yaw pitch roll 分别代表着绕三个轴的转动,单位是 弧度 。
  前文介绍过了,可能有人感觉这东西不好记,很容易忘掉哪个对应哪个坐标轴,其实你可以发现,yaw pitch roll 分别对应着 Z,Y,X轴的旋转,也就是把我们总说的XYZ的反过来,只要记住顺序还是不容易弄错的。
3 再之后的frame_id为坐标系变换中的父坐标系, child_frame_id为坐标系变换中的子坐标系。
4 最后一个参数为发布频率,单位为 毫秒。通常取100。

   一毫秒为一秒的千分之一,100毫秒即为0.1秒,也就是10Hz。

3 实例


现有如上坐标变换,想要再加上一个camera_link与kinect_Link的坐标变换,
<node pkg="tf" type="static_transform_publisher" name="camera_base_link"
  args="0 0 0 0 0 0 kinect_Link camera_link 100" />
这是没有加旋转的时候:

可以看到这两个坐标系重合了,所以要加上旋转才行,要把camera_link的方向弄到与base_link一致才行。
<node pkg="tf" type="static_transform_publisher" name="camera_base_link"
  args="0 0 0 1.57079 -1.57079 0 kinect_Link camera_link 100" />



现在方向对了。
yaw这种方式的旋转式有顺序的,具体顺序。。。我忘了。。。



至于四元数方式。。。我不懂,不在这里说了。




  • 36
    点赞
  • 174
    收藏
    觉得还不错? 一键收藏
  • 9
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值