ros tf

欢迎访问我的博客首页


1. tf 命令行工具


1.1 发布 tf


  我们根据 cartographer_ros 的 launch 文件 backpack_2d.launch 写一个 tf.launch,并使用命令 roslaunch cartographer_ros tf.launch 启动。该 launch 文件运行 ros 系统包 robot_state_publisher 中的同名节点 robot_state_publisher,根据 backpack_2d.urdf 文件发布机器人各坐标系到 base_link 的变换。

<launch>
  <param name="robot_description" textfile="$(find cartographer_ros)/urdf/backpack_2d.urdf" />
  <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" />
</launch>

1.2 查看 tf


  使用 rosrun tf view_frames 查看广播的坐标系关系。该命令会在命令行目录生成两个文件 frames.pdf 和 frames.gv。

在这里插入图片描述

图 1.1 广播中的坐标变换关系

上面的命令可能会报错。需要把 /opt/ros/noetic/lib/tf/view_frames 中的 m = r.search(vstr) 修改为 m = r.search(str(vstr))。

Listening to /tf for 5.0 seconds
Done Listening
b'dot - graphviz version 2.43.0 (0)\n'
Traceback (most recent call last):
  File "/opt/ros/noetic/lib/tf/view_frames", line 119, in <module>
    generate(dot_graph)
  File "/opt/ros/noetic/lib/tf/view_frames", line 89, in generate
    m = r.search(vstr)
TypeError: cannot use a string pattern on a bytes-like object

  使用命令 rosrun tf tf_monitor 查看广播的坐标关系。

RESULTS: for all Frames

Frames:
Frame: horizontal_laser_link published by unknown_publisher(static) Average Delay: 0 Max Delay: 0
Frame: imu_link published by unknown_publisher(static) Average Delay: 0 Max Delay: 0
Frame: vertical_laser_link published by unknown_publisher(static) Average Delay: 0 Max Delay: 0

All Broadcasters:
Node: unknown_publisher(static) 1e+08 Hz, Average Delay: 0 Max Delay: 0

  使用 rosrun tf tf_monitor /imu_link /base_link 查看两个坐标系的关系。

Waiting for transform chain to become available between imu_link and base_link 

RESULTS: for imu_link to base_link
Chain is: imu_link -> base_link
Net delay     avg = 3.2183e+08: max = 1.69142e+09

Frames:
Frame: imu_link published by unknown_publisher(static) Average Delay: 0 Max Delay: 0

All Broadcasters:
Node: unknown_publisher(static) 1e+08 Hz, Average Delay: 0 Max Delay: 0

  使用 rosrun tf tf_echo /imu_link /base_link 查看两个坐标系的变换。

At time 0.000
- Translation: [0.000, 0.000, 0.000]
- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]
            in RPY (radian) [0.000, -0.000, 0.000]
            in RPY (degree) [0.000, -0.000, 0.000]

2.参考


1.ROS tf,CSDN,2022。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值