基本概念
1.节点Node
执行具体任务的独立文件
不同节点可以使用不同的编程语言
节点在系统中的名称唯一
2.节点管理器 ROS Master
完成节点的命名、注册
辅助节点之间的查找、连接、通信
储存参数,供节点调用
3.参数 Parameter
节点可通过网络访问Master的参数服务器
适合存储静态、配置类的参数
4.通信
类型① 话题 Topic
异步通信机制,单向传输
由发布者Publisher发布给订阅者Subscriber
同一话题的发布者与订阅者不唯一
消息 Message
话题所传输的数据
具有类型和数据结构
由无关编程语言的.msg文件定义
类型② 服务 Service
同步通信机制,双向传输
客户端/服务器模型 请求与应答 request&response
由无关编程语言的.srv文件定义请求与应答的数据结构
5.功能包 Package
ROS中的基本单元 包含源码、配置文件、数据定义等
功能包清单Package Manifest 包含功能包的相关信息,包括对其他功能包的依赖信息等
元功能包 Meta Packages
基本命令
1.rosnode
rosnode is a command-line tool for printing information about ROS Nodes.
rosnode
可获取有关rosnode的相关指令
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
例子:获取节点相关信息
rosnode info /turtlesim
2.rostopic
rostopic is a command-line tool for printing information about ROS Topics.
rostopic
Commands:
rostopic bw display bandwidth used by topic
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
例子:发布话题数据
rostopic pub -r 频率 话题名 话题数据类型 具体数据
rostopic pub -r 10 /turtle1/cmd_vel geometry_msgs/Twist "linear:
x: 0.0
y: 1.0
z: 0.0
angular:
x: 0.0
y: 0.0
z: 0.0"
rosmsg
rosservice
工具 rqt_graph
工具rosbag
例子:记录所有发布的数据
rosbag record -a -O rosbag_rocrd_test