1 rqt
1.1 安装
不同的版本 安装方式不同。
# apt2.0 Ubuntu 20.04 and newer
$ sudo apt update
$ sudo apt install ~nros-<distro>-rqt*
# apt1.x Ubuntu 18.04 and older
$ sudo apt update
$ sudo apt install ros-<distro>-rqt*
1.2 rqt_graph
运行rqt_graph,也可以从rqt打开,rqt_graph清晰地展示了节点、话题等图元素的关系。
1.3 rqt_console
记录终端的日志,也是一个节点,收集/rosout的信息,可以根据日志等级过滤,也可以高亮一些内容。
$ ros2 run rqt_console rqt_console
上中下一共三个窗口,上面窗口列出了所有的日志,中间窗口可以根据日志等级进行筛选,下面的额窗口可以高亮一些需要的字符串。
日志等级按严重性,如下排列:
Fatal
Error
Warn
Info
Debug
2 launch file
Launch files allow you to start up and configure a number of executables containing ROS 2 nodes simultaneously.
$ ros2 launch <launch_file_name>
launch文件的编写在后续博文中单列一节~
3 ros2bag
记录topic发布的数据,可选择记录哪些topic,事后可以对ros包进行回放。
# 录包
# 包存在于 录包终端 所在的目录下
$ ros2 bag record <topic_name>
# 同时录多个话题,话题之间使用空格分开
# 使用 -o 选项可以设置包名
$ ros2 bag record -o <bag_file_name> <topic1_name> <topic2_name>
# 使用 -a 选项是记录所有topic,在存在循环依赖的系统中 不建议使用
$ ros2 bag record -a
# 查看包的信息
$ ros2 bag info <bag_file_name>
# 有这些信息
Files: subset.db3
Bag size: 228.5 KiB
Storage id: sqlite3
Duration: 48.47s
Start: Oct 11 2019 06:09:09.12 (1570799349.12)
End Oct 11 2019 06:09:57.60 (1570799397.60)
Messages: 3013
Topic information: Topic: /turtle1/cmd_vel | Type: geometry_msgs/msg/Twist | Count: 9 | Serialization Format: cdr
Topic: /turtle1/pose | Type: turtlesim/msg/Pose | Count: 3004 | Serialization Format: cdr
# 回放
$ ros2 bag play <bag_file_name>