ROS常用指令集合

ROS常用指令集合

1.功能包相关指令

  • rospack : 获取、查找工作包

catkin_create_pkg: 创建功能包

catkin_make: 功能包编译指令

  • rosdep: 功能包依赖相关指令

  • roscd: 更改目录
  • rosed: 编辑文件
  • roscp: 功能包复制

  • rosls: 功能包下的文件列表

2.topic相关指令

3.service相关指令

4.msg/srv相关指令

5.param相关指令

6.node相关指令

7.rqt相关指令

  • rqt相关指令如下:

常用的rqt工具包括rqt_runtime_monitor、rqt_console、rqt_plot、rqt_graph、rqt_tf_tree、tf_image_view、rqt_reconfigure。以下分别对上述常用指令进行介绍。
rqt_runtime_monitor
运行rqt_runtime_monitor的指令为:

rosrun rqt_runtime_monitor rqt_runtime_monitor

运行窗口如图所示,可以通过左边的状态分辨机器人是否存在故障。

  • rqt_console
    运行rqt_console的指令为:
rosrun rqt_console rqt_console

运行窗口如图所示,可以在窗口中查看机器人的打印消息。

  • rqt_plot
    运行rqt_plot的指令为:
rosrun rqt_plot rqt_plot [options:data]

运行窗口如图所示,可以窗口可动态显示机器人中topic消息中的数值型数据,比如x方向的线速度或者z方向的角速度等等。

  • rqt_graph
    运行rqt_graph的指令为:
rosrun rqt_graph rqt_graph [options:data]

运行窗口如图所示,该工具主要用于显示运行节点之间的关系图,用于分析节点关系与故障。

  • rqt_tf_tree
    运行rqt_tf_tree的指令为:
rosrun rqt_tf_tree rqt_tf_tree

  • rqt_image_view用于显示图像数据,rqt_reconfigure用于动态配置系统参数,可以用于机器人调试参数。

8.消息录制与回放指令

rosbag 指令用于消息录制与回放

rosbag record -a  <录制所有消息>
rosbag record /topic1 /topic2 /topic3 <录制制定topic>
rosbag play xxxx.bag <回放bag文件>

9.故障诊断相关指令

  • roswtf
    当系统出现异常时,可以运行roswtf查看相关问题。运行结果如图所示,图中提示"ERROR ROS Dep database not updated",并给出了解决方案,运行’rosdep update’.

10.调试相关配置

  • gdb调试器节点
<launch>
	<node pkg="pkg_name" type="node_type" name="node_name" launch_prefix="xterm -x gdb --args"/>
</launch>
  • valgrind分析节点内存
<launch>
	<node pkg="pkg_name" type="node_type" name="node_name"   output ="screen" launch_prefix="valgrind"/>
</launch>