Package Summary
tf is a package that lets the user keep track of multiple coordinate frames over time. tf maintains the relationship between coordinate frames in a tree structure buffered in time, and lets the user transform points, vectors, etc between any two coordinate frames at any desired point in time.
tf是一个软件包,可让用户随时间跟踪多个坐标系。 tf保持时间缓冲的树结构中的坐标系之间的关系,并允许用户在任意所需的时间点在任意两个坐标系之间转换点,向量等。
Migration: Since ROS Hydro, tf has been "deprecated" in favor of tf2. tf2 is an iteration on tf providing generally the same feature set more efficiently. As well as adding a few new features.
迁移:自ROS Hydro以来,tf被“弃用”,而转而使用tf2。 tf2是tf的迭代,通常可以更有效地提供相同的功能集。 以及添加了一些新功能。
As tf2 is a major change the tf API has been maintained in its current form. Since tf2 has a superset of the tf features with a subset of the dependencies the tf implementation has been removed and replaced with calls to tf2 under the hood. This will mean that all users will be compatible with tf2. It is recommended for new work to use tf2 directly as it has a cleaner interface. However tf will continue to be supported for through at least J Turtle.
由于tf2是一项重大更改,因此tf API已保持其当前形式。 由于tf2具有tf功能的超集以及部分依赖项,因此tf实现已被删除,并在幕后被对tf2的调用所取代。 这意味着所有用户都将与tf2兼容。 建议新工作直接使用tf2,因为它的界面更干净。 但是,至少将通过J Turtle继续支持tf。
- Maintainer status: maintained
- Maintainer: Tully Foote <tfoote AT osrfoundation DOT org>
- Author: Tully Foote, Eitan Marder-Eppstein, Wim Meeussen
- License: BSD
- Source: git https://github.com/ros/geometry.git (branch: melodic-devel)
目录
- What does tf do? Why should I use tf?
- Paper
- Tutorials
- Code API Overview
- Frequently asked questions
- Command-line Tools
- Nodes
What does tf do? Why should I use tf?
You want to see what tf can do instead of just reading about it? Check out the tf introduction demo.
您想看看tf可以做什么,而不仅仅是阅读它? 查看tf简介演示。
A robotic system typically has many 3D coordinate frames that change over time, such as a world frame, base frame, gripper frame, head frame, etc. tf keeps track of all these frames over time, and allows you to ask questions like:
机器人系统通常具有随时间变化的许多3D坐标框架,例如世界框架,基础框架,抓手框架,头部框架等。tf随时间跟踪所有这些框架,并允许您提出以下问题:
- Where was the head frame relative to the world frame, 5 seconds ago?
- 5秒钟前,头部框架相对于世界框架在哪里?
- What is the pose of the object in my gripper relative to my base?
- 夹具中物体相对于底座的姿势是什么?
- What is the current pose of the base frame in the map frame?
- 地图框架中基础框架的当前姿势是什么?
tf can operate in a distributed system. This means all the information about the coordinate frames of a robot is available to all ROS components on any computer in the system. There is no central server of transform information.
tf可以在分布式系统中运行。 这意味着有关机械手坐标系的所有信息可用于系统中任何计算机上的所有ROS组件。 没有转换信息的中央服务器。
For more information on the design see /Design
有关设计的更多信息,请参见/ Design。
Paper论文
There is a paper on tf presented at TePRA 2013 Papers/TePRA2013_Foote
在TePRA 2013论文/ TePRA2013_Foote上有一篇关于tf的论文
Tutorials 教程
We created a set of tutorials that walk you through using tf, step by step. You can get started on the introduction to tf tutorial. For a complete list of all tf and tf-related tutorials check out the tutorials page.
我们创建了一组教程,逐步引导您使用tf。 您可以开始学习tf教程。 有关所有与tf和tf相关的教程的完整列表,请查看 tutorials 页面。
There are essentially two tasks that any user would use tf for, listening for transforms and broadcasting transforms.
任何用户基本上都会使用tf进行两项任务,即监听转换和广播转换。
Anyone using tf will need to listen for transforms:
任何使用tf的人都需要听转换:
-
Listening for transforms - Receive and buffer all coordinate frames that are broadcasted in the system, and query for specific transforms between frames. Check out the writing a tf listener tutorial (Python) (C++).
To extend the capabilities of a robot you will need to start broadcasting transforms.
要扩展机器人的功能,您将需要开始广播转换。
-
Broadcasting transforms - Send out the relative pose of coordinate frames to the rest of the system. A system can have many broadcasters that each provide information about a different part of the robot. Check out the writing a tf broadcaster tutorial (Python) (C++).
-
将坐标系的相对姿势发送给系统的其余部分。 一个系统可以有许多广播者,每个广播者提供有关机器人不同部分的信息。 查看编写tf广播员教程 (Python) (C++)的内容。
Once you are finished with the basic tutorials, you can move on to learn about tf and time. The tf and time tutorial (Python) (C++) teaches the basic principles of tf and time. The advanced tutorial about tf and time (Python) (C++) teaches the principles of time traveling with tf.
完成基本教程后,您可以继续学习tf和时间。 tf和时间教程(Python) (C++) 教授tf和时间的基本原理。 有关tf和时间 (Python) (C++) 的高级教程讲授了使用tf和time的基本原理。
Code API Overview
Frequently asked questions
Command-line Tools 命令行工具
Although tf is mainly a code library meant to be used within ROS nodes, it comes with a large set of command-line tools that assist in the debugging and creation of tf coordinate frames. These tools include:
尽管tf主要是打算在ROS节点内使用的代码库,但它带有大量的命令行工具,可帮助调试和创建tf坐标系。 这些工具包括:
-
view_frames: visualizes the full tree of coordinate transforms.
-
view_frames: 可视化整个坐标变换树。
-
tf_monitor: monitors transforms between frames.
-
tf_monitor: 监视帧之间的变换。
-
tf_echo: prints specified transform to screen
-
tf_echo:将指定的转换输出到屏幕
-
roswtf: with the tfwtf plugin, helps you track down problems with tf.
-
roswtf: 使用tfwtf插件,可以帮助您查找tf的问题。
-
static_transform_publisher is a command line tool for sending static transforms.
-
static_transform_publisher是用于发送静态转换的命令行工具。
You may also wish to use the tf_remap node, which is a utility node for remapping coordinate transforms.
您可能还希望使用tf_remap节点,它是用于重新映射坐标变换的实用程序节点。
tf_monitor
tf_monitor
- Print information about the current coordinate transform tree to console. For example:
- 将有关当前坐标变换树的信息输出到控制台。 例如:
$ rosrun tf tf_monitor RESULTS: for all Frames Frames: Frame: /base_footprint published by /robot_pose_ekf Average Delay: 0.0469324 Max Delay: 0.0501503 Frame: /base_laser_link published by /robot_state_publisher Average Delay: 0.00891066 Max Delay: 0.009591 Frame: /base_link published by /robot_state_publisher Average Delay: 0.00891147 Max Delay: 0.009592 0.00891431 Max Delay: 0.009595 ... editing for the sake of brevity ... Broadcasters: Node: /realtime_loop 94.7371 Hz, Average Delay: 0.000599916 Max Delay: 0.001337 Node: /robot_pose_ekf 30.8259 Hz, Average Delay: 0.0469324 Max Delay: 0.0501503 Node: /robot_state_publisher 25.8099 Hz, Average Delay: 0.0089224 Max Delay: 0.00960276
tf_monitor <source_frame> <target_target>
-
Monitor a specific transform. For example, to monitor the transform from /base_footprint to /odom:
-
监视特定的转换。 例如,监视从/ base_footprint到/ odom的转换:
$ rosrun tf tf_monitor /base_footprint /odom RESULTS: for /base_footprint to /odom Chain currently is: /base_footprint -> /odom Net delay avg = 0.00371811: max = 0.012472 Frames: Frame: /base_footprint published by /robot_pose_ekf Average Delay: 0.0465218 Max Delay: 0.051754 Frame: /odom published by /realtime_loop Average Delay: 0.00062444 Max Delay: 0.001553 Broadcasters: Node: /realtime_loop 95.3222 Hz, Average Delay: 0.00062444 Max Delay: 0.001553 Node: /robot_pose_ekf 30.9654 Hz, Average Delay: 0.0465218 Max Delay: 0.051754 Node: /robot_state_publisher 25.9839 Hz, Average Delay: 0.00903061 Max Delay: 0.00939562
tf_echo
tf_echo <source_frame> <target_frame>
-
Print information about a particular transformation between a source_frame and a target_frame. For example, to echo the transform between /map and /odom:
-
打印有关source_frame和target_frame之间的特定转换的信息。 例如,回显/ map和/ odom之间的转换:
$ rosrun tf tf_echo /map /odom At time 1263248513.809 - Translation: [2.398, 6.783, 0.000] - Rotation: in Quaternion [0.000, 0.000, -0.707, 0.707] in RPY [0.000, -0.000, -1.570]
static_transform_publisher
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.
- 使用x/y/z偏移(米)和偏航/俯仰/滚转弧度将静态坐标变换发布到tf。(偏航是围绕Z旋转,俯仰是围绕Y旋转,横摇是围绕X旋转)。周期(以毫秒为单位)指定发送转换的频率。100毫秒(10赫兹)是一个很好的数值。
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.
- 使用以米和四元数表示的x / y / z偏移量将静态坐标转换发布到tf。 周期(以毫秒为单位)指定发送转换的频率。 100ms(10hz)是一个不错的选择。
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:
static_transform_publisher被设计为手动使用的命令行工具,也可以在roslaunch文件中用于设置静态转换。例如:
1 <launch> 2 <node pkg="tf" type="static_transform_publisher" name="link1_broadcaster" args="1 0 0 0 0 0 1 link1_parent link1 100" /> 3 </launch>
view_frames
view_frames is a graphical debugging tool that creates a PDF graph of your current transform tree.
view_frames是一个图形调试工具,可创建当前转换树的PDF图形。
$ rosrun tf view_frames
You probably want to view the graph when you are done, so a typical usage on Ubuntu systems is:
您可能希望在完成后查看图形,因此在Ubuntu系统上的典型用法是:
$ rosrun tf view_frames $ evince frames.pdf
Therefore an helpful shortcut to add in your .bashrc is:
因此,添加.bashrc的有用快捷方式是:
alias tf='cd /var/tmp && rosrun tf view_frames && evince frames.pdf &'
NOTE: See also rqt_tf_tree that allows dynamic introspection of the frames.
注意:另请参见rqt_tf_tree,它允许对帧进行动态自检。
roswtf plugin
roswtf 插件
roswtf tf comes with a plugin for roswtf that automatically runs whenever you run roswtf. This plugin will analyze your current tf configuration and attempt to find common problems. To run, just invoke roswtf normally:
roswtf tf带有roswtf插件,该插件在您运行roswtf时自动运行。 该插件将分析您当前的tf配置,并尝试查找常见问题。 要运行,只需正常调用roswtf:
$ roswtf
Nodes
tf_remap
tf_remap listens to the /tf_old topic and republishes transforms on the /tf topic. This is mainly used with out-of-date bag files that need their coordinate frame IDs updated. The typical operation for this node is to play the bag file with /tf:=/tf_old. The tf_remap node is run with a ~mappings parameter that describes the mapping of frame IDs from old to new.
tf_remap侦听/ tf_old主题,并重新发布有关/ tf主题的转换。 这主要用于需要更新其坐标框架ID的过时包文件。 该节点的典型操作是使用/ tf:= /tf_old 播放bag文件。 tf_remap节点使用〜mappings参数运行,该参数描述帧ID从旧到新的映射。
Subscribed Topics
订阅主题
/tf_old (tf/tfMessage)
- Old transform tree. This is usually published by remapping playback of a bag file. You may need to set use_sim_time true for the bag file transforms to be accepted.
- 旧的变换树。 这通常是通过重新映射bag文件的播放来发布的。 您可能需要将use_sim_time设置为true才能接受bag文件转换。
Published Topics
/tf (tf/tfMessage)
- Current transform tree. This is the normal /tf topic.
- 当前变换树。 这是正常的/ tf主题。
Parameters
~mappings ([ {str: str} ], default: [])
- List of dictionaries that map old tf frame IDs to new frame IDs. Each dictionary in the list must have an "old" and "new" key.
- 将旧的tf frame ID映射到新的frameID的词典列表。 列表中的每个字典都必须具有“old”和“new”关键字。
change_notifier
change_notifier listens to /tf and periodically republishes any transforms that have changed by a given amount on the /tf_changes topic.
change_notifier 侦听/ tf,并定期重新发布所有转换( 由 / tf_changes主题给定的数据改变引起的 ) 。
Subscribed Topics
订阅主题
/tf (tf/tfMessage)
- Transform tree.
Published Topics
发布主题
/tf_changes (tf/tfMessage)
- Reduced transform tree.
Parameters
~polling_frequency (float, default: 10.0)
- Frequency (hz) at which to check for any changes to the transform tree.
- 检查变换树是否有任何更改的频率(hz)。
~translational_update_distance (float, default: 0.1)
- Minimum distance between the origin of two frames for the transform to be considered changed.
- 两个帧的原点之间的最小距离,被认为是改变了。
~angular_update_distance (float, default: 0.1)
- Minimum angle between the rotation of two frames for the transform to be considered changed.
- 两个帧之间的旋转之间的最小角度,被认为是改变了。
# Keywords Transformation, Transformations, coordinate transform