目录
1.rosnode list——list active nodes
2.rosnode ping——test connectivity to node
3.rosnode info——print information about node
4.rosnode machine——list nodes running on a particular machine or list machines
5.rosnode kill——kill a running node
6.rosnode——cleanup purge registration information of unreachable nodes
1.rostopic list——list active topics
2.rostopic echo——print messages to screen
3.rostopic pub——publish data to topic
1.rosservice list——list active services
2.rosservice call——call the service with the provided args
3.rosservice info——print information about service
4.rosservice type——print service type
1.rosmsg list——List all messages
2.rosmsg info——Alias for rosmsg show
1.rossrv list——List all services
2.rossrv info—— Alias for rossrv show
1.rosparam list——list parameter names
3.rosparam delete——delete parameter
4. rosparam load——load parameters from file、rosparam dump——dump parameters to file
学习参考:赵虚左的课程,其他书上不详细。
有必要学习,作为ROS系统动态的常用指令,同时作为一个工具,常用来测试和改错,让测试和改错有理有据。
rosnode
rosnode提供6个指令
rosmelodic@rosmelodic-virtual-machine:~/catkin_ws$ rosnode
cleanup info kill list machine ping
添加-h获取帮助。
rosmelodic@rosmelodic-virtual-machine:~/catkin_ws$ rosnode -h
rosnode is a command-line tool for printing information about ROS Nodes.
Commands:
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
Type rosnode <command> -h for more detailed usage, e.g. 'rosnode ping -h'
rosnode ping 测试到节点的连接状态
rosnode list 列出活动节点
rosnode info 打印节点信息
rosnode machine 列出指定设备上节点
rosnode kill 杀死某个节点
rosnode cleanup 清除不可连接的节点
1.rosnode list——list active nodes
准备工作:
4.ROS编程学习:自定义话题消息与c++调用_机械专业的计算机小白的博客-CSDN博客https://blog.csdn.net/wzfafabga/article/details/127161241启动之前实现的c++调用自定义消息类型的话题通信。
启动ROS Master:
roscore
启动订阅者:
source ./devel/setup.bash
rosrun sub_pub sub_person
启动发布者:
source ./devel/setup.bash
rosrun sub_pub pub_person
rosnode list:
rosnode list
rosmelodic@rosmelodic-virtual-machine:~/catkin_ws$ rosnode list
/ren_pub
/ren_sub
/rosout
其中/ren_pub和/ren_sub节点为发布者和订阅者节点,/rosout是ROS Master的日志输出节点。
2.rosnode ping——test connectivity to node
rosnode ping /节点名
判断节点的连通性。
rosnode ping /ren_pub
连通成功,而且显示连通的延迟。
rosmelodic@rosmelodic-virtual-machine:~/catkin_ws$ rosnode ping /ren_pub
rosnode: node is [/ren_pub]
pinging /ren_pub with a timeout of 3.0s
xmlrpc reply from http://rosmelodic-virtual-machine:40397/ time=14.780998ms
xmlrpc reply from http://rosmelodic-virtual-machine:40397/ time=0.508070ms
xmlrpc reply from http://rosmelodic-virtual-machine:40397/ time=0.519991ms
查询一个不存在的节点:查询失败。
rosmelodic@rosmelodic-virtual-machine:~/catkin_ws$ rosnode ping /ren_pu
rosnode: node is [/ren_pu]
cannot ping [/ren_pu]: unknown node
3.rosnode info——print information about node
打印节点信息,用处大包含信息全面。
rosnode info /节点名
rosmelodic@rosmelodic-virtual-machine:~/catkin_ws$ rosnode info /ren_pub
--------------------------------------------------------------------------------
Node [/ren_pub]
Publications:
* /renxinxi [sub_pub/Person]
* /rosout [rosgraph_msgs/Log]
Subscriptions: None
Services:
* /ren_pub/get_loggers
* /ren_pub/set_logger_level
contacting node http://rosmelodic-virtual-machine:40397/ ...
Pid: 50789
Connections:
* topic: /rosout
* to: /rosout
* direction: outbound (34961 - 127.0.0.1:37480) [11]
* transport: TCPROS
* topic: /renxinxi
* to: /ren_sub
* direction: outbound (34961 - 127.0.0.1:37490) [12]
* transport: TCPROS
4.rosnode machine——list nodes running on a particular machine or list machines
ROS分布式通信,可能存在多台设备,需要通过这个方式去查询都有哪些机器和某个机器中的节点。
rosmelodic@rosmelodic-virtual-machine:~/catkin_ws$ rosnode machine
rosmelodic-virtual-machine
rosmelodic@rosmelodic-virtual-machine:~/catkin_ws$ rosnode machine rosmelodic-virtual-machine
/ren_pub
/ren_sub
/rosout
5.rosnode kill——kill a running node
杀掉一个节点
rosmelodic@rosmelodic-virtual-machine:~/catkin_ws$ rosnode kill
1. /ren_pub
2. /ren_sub
3. /rosout
Please enter the number of the node you wish to kill.
> 1
killing /ren_pub
killed
被杀掉的节点控制台发出警告: