ROS TF工具的使用

1.打印坐标系转换关系 tf_echo

命令格式:

rosrun tf tf_echo <source_frame> <target_frame> 

输出数据类型:geometry_msgs::TransformStamped

2.发布静态坐标变换 static_transform_publisher

欧拉角格式命令:

rosrun tf2_ros static_transform_publisher <x> <y> <z> <yaw> <pitch> <roll> <frame_id> <child_frame_id>

四元数格式命令:

rosrun tf2_ros static_transform_publisher <qx> <qy> <qz> <qw> <yaw> <pitch> <roll> <frame_id> <child_frame_id> 

参数介绍:

<x> <y> <z>:x轴偏移量 y轴偏移量 z轴偏移量 (单位:米)

<yaw> <pitch> <roll>: z偏航角 y俯仰角 x横滚角 (单位:弧度)

<qx> <qy> <qz> <qw> :单位四元数 x y z w

<frame_id> <child_frame_id>: 父级坐标系 子级坐标系 

注:该命令适合临时使用,否则写到launch文件里更清晰:

<launch>
    <node pkg="tf2_ros" type="static_transform_publisher" name="son1" args="0.2 0.8 0.3 0 0 0 /world /son1" output="screen" />
    <node pkg="tf2_ros" type="static_transform_publisher" name="son2" args="0.5 0 0 0 0 0 /world /son2" output="screen" />
</launch>

3. 为当前的 TF tree 创建PDF

sudo apt install ros-noetic-tf2-tools
rosrun tf2_tools view_frames.py

查看当前目录会生成一个 frames.pdf 文件,可以直接进入目录打开文件,或者调用命令查看文件:

evince frames.pdf

猜你喜欢

转载自blog.csdn.net/weixin_44709392/article/details/124560512