1、使用rqt_graph可视化工具查看系统中运行的计算图
rqt_graph
结果显示:
2、resnode 系列
rosnode ping test connectivity to node
rosnode list list active nodes
rosnode info print information about node
rosnode machine list nodes running on a particular machine or list machines
rosnode kill kill a running node
rosnode cleanup purge registration information of unreachable nodes
(1)查看话题列表
rosnode list
结果显示:
(2)发布话题消息
rosnode info /turtlesim
3、rostopic系列,话题消息
rostopic delay display delay of topic from timestamp in header
rostopic echo print messages to screen
rostopic find find topics by type
rostopic hz display publishing rate of topic
rostopic info print information about active topic
rostopic list list active topics
rostopic pub publish data to topic
rostopic type print topic or field type
发布话题消息,按下Ctrl+C,指令发布停止
修改指标,海龟只移动一次
rostopic pub /turtle1/cmd_vel geometry_msgs/Twist "linear:
海龟持续移动,撞了南墙还在动
ros@ubuntu:~$ rostopic pub -r 10 /turtle1/cmd_vel geometry_msgs/Twist "linear:
x: 1.0
y: 0.0
z: 0.0
angular:
x: 0.0
y: 0.0
z: 0.0"
修改Z坐标。海龟可以旋转
ros@ubuntu:~$ rostopic pub -r 10 /turtle1/cmd_vel geometry_msgs/Twist "linear:
x: 1.0
y: 0.0
z: 0.0
angular:
x: 0.0
y: 0.0
z: 1.0
4、rosservice 系列,服务请求
rosservice args print service arguments
rosservice call call the service with the provided args
rosservice find find services by service type
rosservice info print information about service
rosservice list list active services
rosservice type print service type
rosservice uri print service ROSRPC uri
发布服务请求
搞一只新的海龟
rosservice call /spawn "x: 2.0
y: 2.0
theta: 0.0
name: 'turtles2'"
5、rosbag系列
话题记录
话题记录,输入以下指令,移动海龟,海归的运动轨迹就会被记录在cmd_record.bag中
rosbag record -a -O cmd_record
话题复现
话题复现,执行下列代码,海龟会按照记录线重新走一遍
rosbag play cmd_record.bag