赞
踩
参考:
*此处重点,ROS1成熟,而ROS2还是深度开发中的实验版,LTS长期支持版目前也没有5年,而是3年,此版本不适合初学者学习!
rviz2中可视化
rqt_tf_tree
TF2 核心独立于 ROS & BufferCore 类提供 API
提供坐标之间的转换(动态/静态)。
可以访问变换树并查找 2 帧之间的特定变换(阻塞/非阻塞)。
- buffer = tf2_ros.Buffer()
- transform = buffer.lookup_transform("base_link","camera_link", rclpy.time.Time()) # Blocking
- transform = await buffer.lookup_transform_async("base_link","camera_link",rclpy.time.Time()) #Non-Blocking
函数原型:lookup_transform(target_frame,source_frame,time)
使用 rclpy.time.Time() 提供最新的可用转换。
tf2_ros buffer_server.exe
tf2_ros static_transform_publisher.exe
tf2_ros tf2_echo.exe
tf2_ros tf2_monitor.exe
tf2_tools view_frames.py
ros2 launch dummy_robot_bringup dummy_robot_bringup.launch.py rviz2
发布坐标变换数据
ros2 run tf2_ros static_transform_publisher 1 2 3 0.5 0.1 -1.0 foo bar
接受坐标变换数据
ros2 run tf2_ros tf2_echo foo bar
数据:
- [INFO] [1628841444.349748000] [tf2_echo]: Waiting for transform foo -> bar: Invalid frame ID "foo" passed to canTransform argument target_frame - frame does not exist
- At time 0.0
- - Translation: [1.000, 2.000, 3.000]
- - Rotation: in Quaternion [-0.475, -0.076, 0.240, 0.843]
- At time 0.0
- - Translation: [1.000, 2.000, 3.000]
- - Rotation: in Quaternion [-0.475, -0.076, 0.240, 0.843]
- At time 0.0
- - Translation: [1.000, 2.000, 3.000]
- - Rotation: in Quaternion [-0.475, -0.076, 0.240, 0.843]
- At time 0.0
- - Translation: [1.000, 2.000, 3.000]
- - Rotation: in Quaternion [-0.475, -0.076, 0.240, 0.843]
- At time 0.0
- - Translation: [1.000, 2.000, 3.000]
- - Rotation: in Quaternion [-0.475, -0.076, 0.240, 0.843]
- At time 0.0
- - Translation: [1.000, 2.000, 3.000]
- - Rotation: in Quaternion [-0.475, -0.076, 0.240, 0.843]
- At time 0.0
- - Translation: [1.000, 2.000, 3.000]
- - Rotation: in Quaternion [-0.475, -0.076, 0.240, 0.843]
- At time 0.0
- - Translation: [1.000, 2.000, 3.000]
- - Rotation: in Quaternion [-0.475, -0.076, 0.240, 0.843]
- At time 0.0
- - Translation: [1.000, 2.000, 3.000]
- - Rotation: in Quaternion [-0.475, -0.076, 0.240, 0.843]
- At time 0.0
- - Translation: [1.000, 2.000, 3.000]
- - Rotation: in Quaternion [-0.475, -0.076, 0.240, 0.843]
- At time 0.0
- - Translation: [1.000, 2.000, 3.000]
- - Rotation: in Quaternion [-0.475, -0.076, 0.240, 0.843]
- ros2 run tf2_ros tf2_monitor
- Gathering data on all frames for 10 seconds...
-
-
-
- RESULTS: for all Frames
-
- Frames:
- Frame: bar, published by <no authority available>, Average Delay: 336.186, Max Delay: 336.186
- Frame: single_rrbot_camera_link, published by <no authority available>, Average Delay: 0.0112712, Max Delay: 0.0168042
- Frame: single_rrbot_hokuyo_link, published by <no authority available>, Average Delay: 0.011265, Max Delay: 0.016798
- Frame: single_rrbot_link1, published by <no authority available>, Average Delay: 0.0112664, Max Delay: 0.0167992
- Frame: single_rrbot_link2, published by <no authority available>, Average Delay: 0.0197751, Max Delay: 0.0335286
- Frame: single_rrbot_link3, published by <no authority available>, Average Delay: 0.0197761, Max Delay: 0.033529
-
- All Broadcasters:
- Node: <no authority available> 34.0131 Hz, Average Delay: 0.940838 Max Delay: 336.186
-
-
-
- RESULTS: for all Frames
-
- Frames:
- Frame: bar, published by <no authority available>, Average Delay: 336.186, Max Delay: 336.186
- Frame: single_rrbot_camera_link, published by <no authority available>, Average Delay: 0.0111137, Max Delay: 0.0169733
- Frame: single_rrbot_hokuyo_link, published by <no authority available>, Average Delay: 0.0111072, Max Delay: 0.0169675
- Frame: single_rrbot_link1, published by <no authority available>, Average Delay: 0.0111086, Max Delay: 0.0169683
- Frame: single_rrbot_link2, published by <no authority available>, Average Delay: 0.0197954, Max Delay: 0.0335286
- Frame: single_rrbot_link3, published by <no authority available>, Average Delay: 0.0197964, Max Delay: 0.033529
-
ros2 run tf2_tools view_frames.py
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。