# This message holds a collection of 3d points, plus optional additional # information about each point.
# Time of sensor data acquisition, coordinate frame ID. Header header
# Array of 3d points. Each Point32 should be interpreted as a 3d point # in the frame given in the header. geometry_msgs/Point32[] points
# Each channel should have the same number of elements as points array, # and the data in each channel should correspond 1:1 with each point. # Channel names in common practice are listed in ChannelFloat32.msg. ChannelFloat32[] channels
# This message is used by the PointCloud message to hold optional data # associated with each point in the cloud. The length of the values # array should be the same as the length of the points array in the # PointCloud, and each value should be associated with the corresponding # point.
# Channel names in existing practice include: # "u", "v" - row andcolumn(respectively) in the left stereo image. # This is opposite to usual conventions but remains for # historical reasons. The newer PointCloud2 message has no # such problem. # "rgb" - For point clouds produced by color stereo cameras. uint8 # (R,G,B) values packed into the least significant 24 bits, # in order. # "intensity" - laser or pixel intensity. # "distance" # The channel name should give semantics of the channel(e.g. # "intensity" instead of "value"). string name # The values array should be 1-1 with the elements of the associated # PointCloud. float32[] values
# This message holds a collection of N-dimensional points, which may # contain additional information such as normals, intensity, etc. The # point data is stored as a binary blob, its layout described by the # contents of the "fields" array.
# The point cloud data may be organized 2d (image-like) or 1d # (unordered). Point clouds organized as 2d images may be produced by # camera depth sensors such as stereo or time-of-flight.
# Time of sensor data acquisition, and the coordinate frame ID (for 3d # points). Header header
# 2D structure of the point cloud. If the cloud is unordered, height is # 1 and width is the length of the point cloud. uint32 height # height != 1: 有组织的二维点云,通过了解相邻点(例如像素)之间的关系,最近邻操作更加高效 uint32 width # point的行数,若height = 1则width为所有点的数量
# Describes the channels and their layout in the binary data blob. PointField[] fields
bool is_bigendian # Is this data bigendian? uint32 point_step # Length of a point in bytes uint32 row_step # Length of a row in bytes # row_step = width * point_step 存所有数据(一个数组)的字节 uint8[] data # Actual point data, size is (row_step*height)
bool is_dense # True if there are no invalid points
big endian & small endian
sensor_msgs/PointField
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# This message holds the description of one point entry in the # PointCloud2 message format. uint8 INT8 = 1 uint8 UINT8 = 2 uint8 INT16 = 3 uint8 UINT16 = 4 uint8 INT32 = 5 uint8 UINT32 = 6 uint8 FLOAT32 = 7 uint8 FLOAT64 = 8
string name # Name of field uint32 offset # Offset from start of point struct uint8 datatype # Datatype enumeration, see above uint32 count # How many elements in the field
//Total number of bytes per point pcl_msg.point_step = 16; pcl_msg.row_step = pcl_msg.point_step * pcl_msg.width; pcl_msg.data.resize(pcl_msg.row_step);
//iterate over the message and populate the fields. for (int i = 0; i < width; i++) { *iterX = //Your x data *iterY = //Your y data *iterZ = //Your z data *iterIntensity = //Your intensity data
// Increment the iterators ++iterX; ++iterY; ++iterZ; ++iterIntensity; }