zoukankan      html  css  js  c++  java
  • tf static_transform_publisher

    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" />

  • 相关阅读:
    cf Inverse the Problem (最小生成树+DFS)
    cf Make It Nondeterministic (简单贪心)
    cf Learn from Life (简单贪心)
    hdu 5057 Argestes and Sequence (数状数组+离线处理)
    hdu 5056 Boring count (类似单调队列的做法。。)
    hdu 5055 Bob and math problem (很简单贪心)
    三样东西能让女人幸福一生
    第01课 OpenGL窗口(4)
    爱情要不要吃回头草?(林忆)
    第01课 OpenGL窗口(3)
  • 原文地址:https://www.cnblogs.com/dayspring/p/12546980.html
Copyright © 2011-2022 走看看