Ros通信机制-话题通信2
Creating a ROS msg and srv
https://wiki.ros.org/ROS/Tutorials/CreatingMsgAndSrv
1、介绍
msg:msg 文件是描述 ROS 消息字段的简单文本文件。 它们用于生成不同语言的消息的源代码。
srv:srv 文件描述服务。 它由两部分组成:请求和响应。
msg文件存放在包的msg目录下,srv文件存放在srv目录下。
msgs 只是简单的文本文件,每行包含一个字段类型和字段名称。 您可以使用的字段类型有:
- int8, int16, int32, int64 (plus uint*)
- float32, float64
- string
- time, duration
- other msg files
- variable-length array[] and fixed-length array[C]
There is also a special type in ROS: Header, the header contains a timestamp and coordinate frame information that are commonly used in ROS. You will frequently see the first line in a msg file have Header header.
Here is an example of a msg that uses a Header, a string primitive, and two other msgs :
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.
