ROS2 常用指令
本章节主要记录ROS2常用指令,方便查阅。
【0】包管理
创建包- ws/src目录下创建
ros2 pkg create demo_cpp --build-type ament_cmake --dependencies rclcpp --license Apache-2.0
创建包服务
ros2 pkg create demo_cpp_serve --build-type ament_cmake --dependencies rclcpp --license Apache-2.0
创建包客户端
ros2 pkg create demo_cpp_client --build-type ament_cmake --dependencies rclcpp --license Apache-2.0
【1】环境相关
激活环境- 每次开新终端都要激活环境
source install/setup.bash
查看环境变量- grep过滤
printenv | grep <grep_name>
一键安装ROS2
wget http://fishros.com/install -O fishros && . fishros
【2】节点管理
查看节点
ros2 node list # 查看当前运行的节点
查看节点信息
ros2 node info /<node_name> # 查看节点信息Subscribers,Publishers,消息接口
【3】话题管理
查看话题
ros2 topic list # 查看当前运行的节点
查看话题信息
ros2 topic info /<topic_name> # 查看话题信息
查看话题数据
ros2 topic echo /<topic_name> # 查看话题数据
【4】服务管理
查看服务
ros2 service list # 查看当前运行的服务
查看服务信息
ros2 service info /<service_name> # 查看服务信息
调用服务
ros2 service call /<service_name> <service_type> <request> # 调用服务
【5】参数管理
查看参数
ros2 param list /<node_name> # 查看节点参数
查看参数信息
ros2 param get /<node_name> <param_name> # 查看节点参数
设置参数
ros2 param set /<node_name> <param_name> <value> # 设置节点参数
删除参数
ros2 param delete /<node_name> <param_name> # 删除节点参数
【6】消息接口管理
查看消息接口
ros2 interface show <msg_type> # 查看消息接口
查看所有消息接口
ros2 interface list # 查看所有消息接口