ROS学习(三)tf功能包

内容参考:ROS_wiki

从ROS Hydro,tf迭代为tf2。
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维护实时缓冲的树结构中的坐标帧之间的关系,并允许用户在任意两个坐标帧之间任意时间点上转换点、向量等。
在这里插入图片描述

基本操作

  • tf_monitor:将当前坐标转换树中所有坐标系的发布状态打印出来(好像没什么用)
$ rosrun tf tf_monitor

在这里插入图片描述

$ rosrun tf tf_monitor /odom /base_footprint

在这里插入图片描述

  • tf_echo <source_frame> <target_frame> 打印从source_frame到target_frame的旋转平移变换
rosrun tf tf_echo /odom /base_footprint

在这里插入图片描述

  • static_transform_publisher:发布两个坐标系之间的静态坐标变换,这两个坐标系不发生相对位置变化。
    命令格式:
    static_transform_publisher x y z yaw pitch roll frame_id child_frame_id period_in_ms
    static_transform_publisher x y z qx qy qz qw frame_id child_frame_id period_in_ms
    在launch中使用:
<launch>
<node pkg="tf" type="static_transform_publisher" name="link1_broadcaster" args="1 0 0 0 0 0 1 link1_parent link1 100" />
</launch>
  • view_frames:生成名为frame.pdf文件,显示整棵TF树的信息。
rosrun tf view_frames
  • roswtf plugin:一个插件,分析你当前的tf配置并试图找出常见问题。
$ roswtf

在这里插入图片描述

节点

  • tf_remap
  • change_notifier

常用的坐标系

常用的坐标系名称,也就是frame_id,有map,odom,base_link,base_footprint,base_laser等。
map:一般设该坐标系为固定坐标系(fixed frame),一般与机器人所在的世界坐标系一致。世界系比如东北天坐标系,enu。
odom:里程计坐标系,里程计坐标系,这里要区分开odom topic,这是两个概念,一个是坐标系,一个是根据编码器(或者视觉等)计算的里程计。但是两者也有关系,odom topic 转化得位姿矩阵是odom–>base_link的tf关系。这时可有会有疑问,odom和map坐标系是不是重合的?(这也是我写这个博客解决的主要问题)可以很肯定的告诉你,机器人运动开始是重合的。但是,随着时间的推移是不重合的,而出现的偏差就是里程计的累积误差。那map–>odom的tf怎么得到?就是在一些校正传感器合作校正的package比如amcl会给出一个位置估计(localization),这可以得到map–>base_link的tf,所以估计位置和里程计位置的偏差也就是odom与map的坐标系偏差。所以,如果你的odom计算没有错误,那么map–>odom的tf就是0.
base_link:机器人本体(基座)坐标系与机器人中心重合,坐标系原点一般为机器人的旋转中心。
base_footprint:原点为base_link原点在地面的投影,有些许区别(z值不同)。
记住这张图,很形象
记住这张图,很形象
The map frame is the parent of odom, and odom is the parent of base_link. Although intuition would say that both map and odom should be attached to base_link, this is not allowed because each frame can only have one parent.
(尽管直觉上map和odom都应该和base_link连接,但是这是不行的,由于每个坐标系只能有一个父坐标系)

想到了在加吧

未完待续…

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值