std_msgs/Bool | std_msgs/Byte | std_msgs/ByteMultiArray |
std_msgs/Char | std_msgs/ColorRGBA | std_msgs/Duration |
std_msgs/Empty | std_msgs/Float32 | std_msgs/Float32MultiArray |
std_msgs/Float64 | std_msgs/Float64MultiArray | std_msgs/Header |
std_msgs/Int16 | std_msgs/Int16MultiArray | std_msgs/Int32 |
std_msgs/Int32MultiArray | std_msgs/Int64 | std_msgs/Int64MultiArray |
std_msgs/Int8 | std_msgs/Int8MultiArray | std_msgs/MultiArrayDimension |
std_msgs/MultiArrayLayout | std_msgs/String | std_msgs/Time |
std_msgs/UInt16 | std_msgs/UInt16MultiArray | std_msgs/UInt32 |
std_msgs/UInt32MultiArray | std_msgs/UInt64 | std_msgs/UInt64MultiArray |
std_msgs/UInt8 | std_msgs/UInt8MultiArray |
geometry_msgs/Accel | geometry_msgs/AccelStamped |
geometry_msgs/AccelWithCovariance | geometry_msgs/AccelWithCovarianceStamped |
geometry_msgs/Inertia | geometry_msgs/InertiaStamped |
geometry_msgs/Point | geometry_msgs/Point32 |
geometry_msgs/PointStamped | geometry_msgs/Polygon |
geometry_msgs/PolygonStamped | geometry_msgs/Pose |
geometry_msgs/Pose2D | geometry_msgs/PoseArray |
geometry_msgs/PoseStamped | geometry_msgs/PoseWithCovariance |
geometry_msgs/PoseWithCovarianceStamped | geometry_msgs/Quaternion |
geometry_msgs/QuaternionStamped | geometry_msgs/Transform |
geometry_msgs/TransformStamped | geometry_msgs/Twist |
geometry_msgs/TwistStamped | geometry_msgs/TwistWithCovariance |
geometry_msgs/TwistWithCovarianceStamped | geometry_msgs/Vector3 |
geometry_msgs/Vector3Stamped | geometry_msgs/Wrench |
geometry_msgs/WrenchStamped |
sensor_msgs/BatteryState | sensor_msgs/CameraInfo | sensor_msgs/ChannelFloat32 |
sensor_msgs/CompressedImage | sensor_msgs/FluidPressure | sensor_msgs/Illuminance |
sensor_msgs/Image | sensor_msgs/Imu | sensor_msgs/JointState |
sensor_msgs/Joy | sensor_msgs/JoyFeedback | sensor_msgs/JoyFeedbackArray |
sensor_msgs/LaserEcho | sensor_msgs/LaserScan | sensor_msgs/MagneticField |
sensor_msgs/MultiDOFJointState | sensor_msgs/MultiEchoLaserScan | sensor_msgs/NavSatFix |
sensor_msgs/NavSatStatus | sensor_msgs/PointCloud | sensor_msgs/PointCloud2 |
sensor_msgs/PointField | sensor_msgs/Range | sensor_msgs/RegionOfInterest |
sensor_msgs/RelativeHumidity | sensor_msgs/Temperature | sensor_msgs/TimeReference |
catkin_create_pkg xxx_msgs
string name1
int64 name2
string name3
hello1 name4
std_msgs/String name5
hello1[] name4
- 其中 hello1.msg 和 hello2.msg 在同一个包下,可以直接 hello1 name4 ;
- 而引用标准库,格式如下 包/类型 名 如 std_msgs/String name5 ;
加中括号 [] 表示数组,含有多个数据;
< build_depend>message_generation</ build_depend>
< exec_depend>message_runtime</ exec_depend>
find_package(catkin REQUIRED COMPONENTS
roscpp
rosmsg
rospy
message_generation
)
add_message_files(
FILES
hello1.msg
hello2.msg
)
这里的 hello.msg 要和你创建的msg文件名称一致,且必须时在msg目录下,否则编译会出现问题
generate_messages(
DEPENDENCIES
std_msgs
)
这个配置的作用是添加生成消息的依赖,默认的时候要添加 std_msgs,根据需求添加 geometry_msgs 等其他包
catkin_package(
# INCLUDE_DIRS include
# LIBRARIES demo_msg
CATKIN_DEPENDS roscpp rosmsg rospy message_runtime
# DEPENDS system_lib
)
为catkin编译提供了依赖message_runtime
cd 工作空间
catkin_make
rosmsg show hello_msgs/hello
或者来到 devel 的 lib/python2.7/dist-package 目录下,查看是否生成和package名称相同的目录,以及目录内是否生成对应的py文件。