ROS学习手记 - 4 理解ROS中的基本概念_ROS_Topics
2015-07-06 10:59
197 查看
参考步骤:http://wiki.ros.org/ROS/Tutorials/UnderstandingTopics
rqt_plot commandline tools.
复习一下教程里关于Topic的解释:
![](http://img.blog.csdn.net/20150706105852851?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
1. 准备工作
确认运行roscore之后,开始我们的turtlesim之旅
一个是接收用户keyboard指令的turtlesim turtle_teleop_key
用rqt_graph工具图形化地查看当前的node和topic运行状态,主从关系等。
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.1 关于Message Type 和 Topic Type 的关系,工具:rostopic & rosmsg
联合使用:We can also use rostopic type in conjunction with rosmsg show to get in depth information about a topic:
For ROS Hydro and later,
用了管道,就是把前一个命令的输出作为参数传给后一个命令。
有一些解释,比如-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]'
rqt_plot to plot the data being published on the
/turtle1/pose topic. First, start rqt_plot by typing
in 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.
![](http://img.blog.csdn.net/20150706171401811?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
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等东东。
Understanding ROS's Topics
This tutorial introduces ROS topics as well as using therostopic andrqt_plot commandline tools.
复习一下教程里关于Topic的解释:
1. 准备工作
确认运行roscore之后,开始我们的turtlesim之旅2. 用rosrun开了两个node,
一个是显示turtlesim窗口的turtlesim turtlesim_node一个是接收用户keyboard指令的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_plot
in 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 topicrostopic 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等东东。
相关文章推荐
- PowerShell管理Exchange
- Linux下的C编程
- Mysql日期时间类型(DATE,DATETIME,TIMESTAMP)和函数及与linux系统时间之间的转换(UNIX_TIMESTAMP、FROM_UNIXTIME)
- Nginx学习之keepalive
- 20、Linux 目录结构
- OpenGL ES2.0的一些总结
- PowerShell-数组的多种录入方法
- java 执行cmd、shell 、exe 返回结果
- OpenGL之GLEW安装
- Linux 设备文件的创建和mdev
- Nginx列出目录和文件并用密码控制访问权限配置方法
- LINUX下的图形系统的一些资料
- Redhat Linux安装JDK 1.7
- 移动终端基带芯片的基本架构介绍之三(移动终端基带芯片详细架构)
- nginx服务器下编写cgi程序
- Tomcat web.xml元素详解
- windows搭建openacs编译环境
- Hyper-V 高可用性 (创建及配置Hyper-V群集)
- Centos7安装Mysql
- Popupwindow 属性设置