简单消息协议:定义了ROS与工业机器人之间简单的消息协议。额外的处理程序和管理器类包含用于处理有限连接的系统。这个包是ROS-Industrial计划的一部分。
简单消息协议定义了ROS驱动层与机器人控制器层通信的消息结构。该消息结构符合下列要求:
1、结构足够简单,可以让ROS与控制器之间共同处理。(对于那些支持C/C++的控制器)。对于那些不支持C/C++的控制器,结构要足够简单,以适应解码能力有限的机器人编程语言。这个需求的一个必然的结果是:协议不应如此繁重,而耗尽机器人控制器有限的资源。
2、结构应该允许数据流(ROS 服务等)
3、结构应该允许数据回复(ROS服务等)
4、协议并不打算封装版本信息。由个体开发人员以确保交流平台开发的代码没有任何版本冲突(这包括消息类型标识符)。
消息结构:
PREFIX Not considered part of the message 前缀 不作为消息的一部分考虑
int LENGTH (HEADER + DATA) in bytes 文件头与文件主体加在一起的字节数。
HEADER 文件头
int MSG_TYPE 确定消息的类型 ( 标准和机器人特定的值 ) identifies type of message (standard and robot specific values)
int COMM_TYPE 确定通信类型 identified communications type
int REPLY CODE 回复服务 (service reply only) reply code
BODY 文件主体
Byte Array 被数据类型和通信类型确定的,可变长度的数据变量,具体数据变量的结构,可参考下面: DATA variable length data determined by message type and and communications type.
消息类型
消息协议允许任意的消息类型和通讯类型的载体数据。但是,客户端/服务器模式 要求双方都需要理解不同的消息类型和通讯类型相关的载体数据。消息类型强制要求载体的数据结构。 消息类型的基类提供 创建主题,回复,请求消息的方法。 如果在客户端和服务器共同使用,开发人员不需要了解载体的数据结构。 不幸的是,一个典型的机器人控制器不能使用C + +类,因此,开发人员必须理解该消息的协议和载体数据的数据结构,以从语法上解析机器人侧发过来的载体数据。消息的具体结构的文档可以在头文件中找到。 为方便起见,消息结构也在这里显示为普通的消息类型。对于类型化的消息结构的更详细的例子, tutorial.
Joint Message
关节消息
这个消息代表关节数据。 注:在早期版本,JOINT message被简单提供,很多关节消息因此造成了混淆(位置、速度、返回值)。为了消除混淆,这个消息类型被改为JOINT_POSITION. 其他类型的消息也会创建,如速度消息、返回值消息。
Member | Type | Value | Size |
Message Type: | StandardMsgType::JOINT_POSITION | 10 | 4 bytes |
Communications Type: | CommType | ANY | 4 bytes |
Reply Type: | ReplyType | ANY | 4 bytes |
Data (Topic, Requests, & Response) | |||
sequence | shared_int | ANY | 4 bytes |
joints | shared_real[10] | ANY | 40 bytes |
File: trajectory_msgs/JointTrajectoryPoint.msg
Raw Message Definition
# or positions[, effort] for the trajectory to be executed.
# All specified values are in the same order as the joint names in JointTrajectory.msg
float64[] positions
float64[] velocities
float64[] accelerations
float64[] effort
duration time_from_start
Compact Message Definition
float64[] positionsfloat64[] velocities
float64[] accelerations
float64[] effort
duration time_from_start
Joint Trajectory Point Message
关节轨迹点消息
点数据作为一个沿着一个轨迹运动的方式,其目的是镜像trajectory_msgs/JointTrajectory点消息。这个点与ROS的轨迹点有以下不同:
的关节速度在工业机器人的标准方法(作为一个单一的值)。
持续时间是一些什么比ROS时间戳不同。时间戳指定当移动应该开始,因为那里的持续时间是移动需时多久。一个很大的假设是,继续执行点的序列。这通常是一个ROS的轨迹真实的,但不是必需的。
The point data serves as a waypoint along a trajectory and is meant to mirror thetrajectory_msgs/JointTrajectoryPoint message. This point differs from the ROS trajectory point in the following ways:
- 关节速度通过工业机器人的标准方法。The joint velocity in an industrial robot standard way (as a single value).
- 持续时间与ROS的时间戳有所不同。 时间戳制定了什么时候应该移动,应该移动的距离。一个大的假设是:持续执行点的队列。这通常是一个真实的ROS轨迹,但不是必须的。The duration is somewhat different than the ROS timestamp. The timestamp specifies when the move should start, where as the duration is how long the move should take. A big assumption is that a sequence of points is continuously executed. This is generally true of a ROS trajectory but not required.
Member | Type | Value | Size |
Message Type: | StandardMsgType::JOINT_TRAJ_PT | 11 | 4 bytes |
Communications Type: | CommType | ANY | 4 bytes |
Reply Type: | ReplyType | ANY | 4 bytes |
Data(Topic & Requests, Response data are empty) | |||
sequence | shared_int | ANY | 4 bytes |
joints | shared_real[10] | ANY | 40 bytes |
velocity | shared_real | ANY | 4 bytes |
duration | shared_real | ANY | 4 bytes
|
简单的信息利用抽象的连接(SmplMsgConnection)接口发送消息到工业机器人控制器。接口有两个假设:
- 能够发送原始字节的连接(raw bytes)。
- 数据连接有一个明确的连接,建立连接(方法)和断开连接的方法。注意:无连接的数据连接,如UDP连接,连接方法可以是一个空操作,用以占位。
tcp套接字连接被包裹在连接接口中。这是推荐的连接类型。
连接管理器和消息处理程序
消息管理器和处理器(MessageHandler 和 MessageManager)类可以用来管理连接,允许多个消息类型处理。消息管理器包含一个消息处理程序列表和接收到消息时执行适当的处理程序。 在拥有少量连接的机器人控制器中,这些类是特别有用的。
Wireshark协议解析器
A Lua Wireshark dissector plugin for the simple message protocol is available fromros-industrial/packet-simplemessage at GitHub. See the readme for information on how to install it.