ROS学习手记 - 4 理解ROS中的基本概念_ROS_Topics
来源:互联网 发布:网络代理合作协议 编辑:程序博客网 时间:2024/06/02 03:35
参考步骤:http://wiki.ros.org/ROS/Tutorials/UnderstandingTopics
Understanding ROS's Topics
This tutorial introduces ROS topics as well as using therostopic andrqt_plot commandline tools.
1. 准备工作
确认运行roscore之后,开始我们的turtlesim之旅
2. 用rosrun开了两个node,
一个是显示turtlesim窗口的turtlesim turtlesim_node
$ rosrun turtlesim turtlesim_node一个是接收用户keyboard指令的turtlesim turtle_teleop_key
$ rosrun turtlesim turtle_teleop_key
3. rqt_graph工具
turtle_teleop_key是publisher,turtlesim_node是listener,用rqt_graph来看当前运行的nodes&topics.
用rqt_graph工具图形化地查看当前的node和topic运行状态,主从关系等。
$ rosrun rqt_graph rqt_graph
4. 使用rostopic工具分析topic相关信息
$rostopic -h //查看说明
4.1 使用rostopic echo打印发送在topic上的数据
rostopic echo shows the data published on a topic.
rostopic echo [topic]
4.2 使用rostopic list查看当前的topic是从属于谁,又领导谁
$ rostopic list -h //查看说明
4.3 使用rostopic hz 显示topic发布的频率
Usage: rostopic hz [topic]
5. ROS Messages
5.1 关于Message Type 和 Topic Type 的关系,工具:rostopic & rosmsg
$ rostopic type /turtle1/cmd_vel //display topic type
$ rosmsg show geometry_msgs/Twist //show msg of ros_topic_type
联合使用:We can also use rostopic type in conjunction with rosmsg show to get in depth information about a topic:
For ROS Hydro and later,
$ rostopic type /turtle1/cmd_vel | rosmsg show
用了管道,就是把前一个命令的输出作为参数传给后一个命令。
5.2 手动发送msg on topic, 工具: rostopic pub
rostopic pub [topic] [msg_type] [args]
有一些解释,比如-1是执行一次,-r 1是以1Hz方式连续发送
rostopic pub /turtle1/cmd_vel geometry_msgs/Twist -r 1 -- '[2.0, 0.0, 0.0]' '[0.0, 0.0, 1.2]'
6. 使用rqs_plot工具
rqt_plot displays a scrolling time plot of the data published on topics. Here we'll userqt_plot to plot the data being published on the/turtle1/pose topic. First, start rqt_plot by typing
$ rosrun rqt_plot rqt_plotin a new terminal. In the new window that should pop up, a text box in the upper left corner gives you the ability to add any topic to the plot. Typing/turtle1/pose/x will highlight the plus button, previously disabled. Press it and repeat the same procedure with the topic/turtle1/pose/y. You will now see the turtle's x-y location plotted in the graph.
---- rostopic命令总结 ----
rostopic bw display bandwidth used by topic
rostopic echo print messages to screen
rostopic hz display publishing rate of topic
rostopic list print information about active topics
rostopic pub publish data to topic
rostopic type print topic type
== 至此,我们完成了对ROS Topic的初步理解,知道了Topic type, message, rate等东东。
- ROS学习手记 - 4 理解ROS中的基本概念_ROS_Topics
- ROS学习手记 - 3 理解ROS中的基本概念_ROS_Nodes
- ROS学习手记 - 5 理解ROS中的基本概念_Services and Parameters
- ROS进阶学习手记 4 -- 使用Eclipse开发ROS
- ROS学习手记11 -- 记录和回放Topic中的数据
- ROS学习手记 - 6 使用ROS中的工具:rqt_console & roslaunch & rosed
- ROS学习笔记四:理解ROS节点
- ROS学习笔记五:理解ROS topics
- ROS学习手记 - 1了解并安装ROS+创建ROS_Package
- ROS学习手记 - 7 创建ROS msg & srv
- ROS学习手记 - 8 编写ROS的Publisher and Subscriber
- ROS学习手记12 -- ROS问题检测工具roswtf
- ROS入门4: 理解ROS节点
- 4、理解ros话题
- ROS学习手记 9 -- 阶段性复习
- ROS进阶学习手记 8 -- 认识tf
- ROS进阶学习手记6.1 -- Launch File
- ROS学习(-)基本概念+发布&订阅消息
- HBase数据导入的几种操作
- imshow和image两个显示函数的区别
- 安卓查看进程和服务等
- PS CC 2014 把一个图层输出为文件的方法
- Linux下的C编程
- ROS学习手记 - 4 理解ROS中的基本概念_ROS_Topics
- 【斯坦福---机器学习】复习笔记之牛顿方法
- HTML5实现IP Camera网页输出
- lock,Monitor,Mutex的区别
- flex 4横向带图下拉列表和联动下拉列表
- Installation error: INSTALL_FAILED_UID_CHANGED解决办法总结
- Java基础日记———Map
- MySQL的配置选项
- 如何将NTFS For Mac手动激活