码迷,mamicode.com
首页 > 其他好文 > 详细

ros中坐标系管理系统

时间:2020-01-29 23:15:29      阅读:275      评论:0      收藏:0      [点我收藏+]

标签:int   新版   logging   arp   direct   point   信息   localhost   方向   

首先安装小海龟实例的功能包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中坐标系管理系统

标签:int   新版   logging   arp   direct   point   信息   localhost   方向   

原文地址:https://www.cnblogs.com/tanshengjiang/p/12241778.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!