ROS笔记 Topics

http://wiki.ros.org/ROS/Tutorials/UnderstandingTopics

  • rostopic
  • rqt_graph
  • rosmsg
rqt_graph

一个用于查看topic的sub/pub关系的node.

rostopic

获取与topic相关的信息

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

几种用法简介

rostopic echo [topic]
实际上就是subscribe了一个topic  当有向这个topic的消息发出时,打印出msg在屏幕上

rostopic list
输出当前的系统有哪些topic及publisher/sunscriber,如下
Published topics:
 * /turtle1/color_sensor [turtlesim/Color] 1 publisher
 * /turtle1/cmd_vel [geometry_msgs/Twist] 1 publisher
 * /rosout [rosgraph_msgs/Log] 2 publishers
 * /rosout_agg [rosgraph_msgs/Log] 1 publisher
 * /turtle1/pose [turtlesim/Pose] 1 publisher

Subscribed topics:
 * /turtle1/cmd_vel [geometry_msgs/Twist] 1 subscriber
 * /rosout [rosgraph_msgs/Log] 1 subscriber
 
 
rostopic type [topic]
显示该topic的消息类型
rostopic type /turtle1/cmd_vel -->  geometry_msgs/Twist

rosmsg show [msgtype]
显示当前type的msg的具体信息
rosmsg show geometry_msgs/Twist,输出如下
geometry_msgs/Vector3 linear
  float64 x
  float64 y
  float64 z
geometry_msgs/Vector3 angular
  float64 x
  float64 y
  float64 z

rostopic pub [topic] [msg_type] [args]
发送一个消息
rostopic pub -1 /turtle1/cmd_vel geometry_msgs/Twist -- '[2.0, 0.0, 0.0]' '[0.0, 0.0, 1.8]'
-1代表发完就退出.  --意思是其后面的内容不是option,不用解析.防止你的具体消息内容里带-

rostopic pub /turtle1/cmd_vel geometry_msgs/Twist -r 1 -- '[2.0, 0.0, 0.0]' '[0.0, 0.0, -1.8]'
-r 1的意思是每秒发1次


rostopic hz [topic]
查看某个topic的发送频率
rqt_plot

rqt_plot displays a scrolling time plot of the data published on topics. Here we'll use rqt_plot to plot the data being published on the /turtle1/pose topic.

转载于:https://www.cnblogs.com/sdu20112013/p/10552594.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值