ros中坐标系管理系统
Posted tanshengjiang
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ros中坐标系管理系统相关的知识,希望对你有一定的参考价值。
首先安装小海龟实例的功能包ros-melodic-turtle-tf
qqtsj ~ sudo apt install ros-melodic-turtle-tf [sudo] qqtsj 的密码: 正在读取软件包列表... 完成 正在分析软件包的依赖关系树 正在读取状态信息... 完成 ros-melodic-turtle-tf 已经是最新版 (0.2.2-0bionic.20191008.205941)。 ros-melodic-turtle-tf 已设置为手动安装。 升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 111 个软件包未被升级。
我的ros系统已经安装好了
然后在启动launch文件,这个launch文件相当于一个脚本,可以一次性启动很多节点
qqtsj ~ roslaunch turtle_tf turtle_tf_demo.launch ... logging to /home/qqtsj/.ros/log/42e2c96a-42a0-11ea-b4ee-9822efa1466f/roslaunch-qqtsj-Nitro-AN515-51-8424.log Checking log directory for disk usage. This may take awhile. Press Ctrl-C to interrupt Done checking log file disk usage. Usage is <1GB. started roslaunch server http://qqtsj-Nitro-AN515-51:34609/ SUMMARY ======== PARAMETERS * /rosdistro: melodic * /rosversion: 1.14.3 * /scale_angular: 2.0 * /scale_linear: 2.0 * /turtle1_tf_broadcaster/turtle: turtle1 * /turtle2_tf_broadcaster/turtle: turtle2 NODES / sim (turtlesim/turtlesim_node) teleop (turtlesim/turtle_teleop_key) turtle1_tf_broadcaster (turtle_tf/turtle_tf_broadcaster.py) turtle2_tf_broadcaster (turtle_tf/turtle_tf_broadcaster.py) turtle_pointer (turtle_tf/turtle_tf_listener.py) auto-starting new master process[master]: started with pid [8435] ROS_MASTER_URI=http://localhost:11311 setting /run_id to 42e2c96a-42a0-11ea-b4ee-9822efa1466f process[rosout-1]: started with pid [8446] started core service [/rosout] process[sim-2]: started with pid [8449] process[teleop-3]: started with pid [8450] process[turtle1_tf_broadcaster-4]: started with pid [8451] process[turtle2_tf_broadcaster-5]: started with pid [8452] process[turtle_pointer-6]: started with pid [8453] Reading from keyboard --------------------------- Use arrow keys to move the turtle. INFO: cannot create a symlink to latest log directory: [Errno 2] No such file or directory: ‘/home/qqtsj/.ros/log/latest‘
小海龟跟随实验,有两只小海龟turtle1和turtle2,然后我们控制小海龟turtle1,通过turtle-tf功能包里面的坐标变换去实现小海龟turtle2的位置跟随,虽然角度和方向不一样,但是实现了坐标的跟随。
接下来介绍一下跟随的原理,以及一个小工具。
运行$ rosrun tf view_frames 他会先监听5秒钟的时间,然后会生成一个frames.pdf文件
view_frames是tf功能包里面的一个小工具,可以直接可视化看到整个系统中tf之间的关系。
qqtsj ~ rosrun tf view_frames Listening to /tf for 5.0 seconds Done Listening dot - graphviz version 2.40.1 (20161225.0304) Detected dot version 2.40 frames.pdf generated
这是当前系统中tf之间的关系, 在当前的两只小海龟的仿真器中有三个坐标系 ,其中word坐标系是全局坐标系,两个小海龟是两个坐标系。
turtle1和turtle2两个坐标系不断的重合到一起,他们相对与word坐标系是不断变化的。
另外还有一个工具更加清楚的观察坐标系之间的关系 tf_echo (可以直接查询坐标系之间的关系)
qqtsj ~ rosrun tf tf_echo turtle1 turtle2 At time 1580309473.964 - Translation: [0.000, 0.000, 0.000] - Rotation: in Quaternion [0.000, 0.000, 0.999, -0.035] in RPY (radian) [0.000, -0.000, -3.072] in RPY (degree) [0.000, -0.000, -176.021] At time 1580309474.700 - Translation: [0.000, 0.000, 0.000] - Rotation: in Quaternion [0.000, 0.000, 0.999, -0.035] in RPY (radian) [0.000, -0.000, -3.072] in RPY (degree) [0.000, -0.000, -176.021] At time 1580309475.691 - Translation: [0.000, 0.000, 0.000] - Rotation: in Quaternion [0.000, 0.000, 0.999, -0.035] in RPY (radian) [0.000, -0.000, -3.072] in RPY (degree) [0.000, -0.000, -176.021] At time 1580309476.699 - Translation: [0.000, 0.000, 0.000] - Rotation: in Quaternion [0.000, 0.000, 0.999, -0.035] in RPY (radian) [0.000, -0.000, -3.072] in RPY (degree) [0.000, -0.000, -176.021] At time 1580309477.692 - Translation: [0.000, 0.000, 0.000] - Rotation: in Quaternion [0.000, 0.000, 0.999, -0.035] in RPY (radian) [0.000, -0.000, -3.072] in RPY (degree) [0.000, -0.000, -176.021] At time 1580309478.700 - Translation: [0.000, 0.000, 0.000] - Rotation: in Quaternion [0.000, 0.000, 0.999, -0.035] in RPY (radian) [0.000, -0.000, -3.072] in RPY (degree) [0.000, -0.000, -176.021] At time 1580309479.691 - Translation: [0.000, 0.000, 0.000] - Rotation: in Quaternion [0.000, 0.000, 0.999, -0.035] in RPY (radian) [0.000, -0.000, -3.072] in RPY (degree) [0.000, -0.000, -176.021] At time 1580309480.699 - Translation: [0.000, 0.000, 0.000] - Rotation: in Quaternion [0.000, 0.000, 0.999, -0.035] in RPY (radian) [0.000, -0.000, -3.072] in RPY (degree) [0.000, -0.000, -176.021] At time 1580309481.691 - Translation: [0.000, 0.000, 0.000] - Rotation: in Quaternion [0.000, 0.000, 0.999, -0.035] in RPY (radian) [0.000, -0.000, -3.072] in RPY (degree) [0.000, -0.000, -176.021] At time 1580309482.700 - Translation: [0.000, 0.000, 0.000] - Rotation: in Quaternion [0.000, 0.000, 0.999, -0.035] in RPY (radian) [0.000, -0.000, -3.072] in RPY (degree) [0.000, -0.000, -176.021]
通过控制小海龟,会观察到数据在不断地变化。
以上是关于ros中坐标系管理系统的主要内容,如果未能解决你的问题,请参考以下文章