ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

Hi @jv00:

What you have here is a message of type" sensor_msgs/PointCloud2.msg: Reference: http://docs.ros.org/en/noetic/api/sensor_msgs/html/msg/PointCloud2.html

# 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
uint32 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
uint8[] data         # Actual point data, size is (row_step*height)

bool is_dense        # True if there are no invalid points

Let's break it a little further: The header message is of type std_msgs/Header.msg

uint32 seq
time stamp
string frame_id

In your case: header: seq: 19 stamp: secs: 124 nsecs: 110000000

uint32 height
uint32 width

frame_id: "camera_depth_optical_frame" height: 480 width: 640

Then comes

PointField[] fields

PointField[] fields is of type sensor_msgs/PointField.msg

The sensor_msgs/PointField.msg is composed of:

# 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

In your case: fields: - name: "x" offset: 0 datatype: 7 count: 1 - name: "y" offset: 4 datatype: 7 count: 1 - name: "z" offset: 8 datatype: 7 count: 1

is_bigendian, point_step and row_step and is_dense are straight forward to understand.

Finally,

uint8[] data

data contains the Actual point data, size is (row_step*height) In your case: data: [0, 0, 192, 127, 0, 0, 192, 127, 0, 0, 192, 127, 0, 0, 0, 0, 178, 178, 178, 0, 0, 0, 0, 0, 0, 0, 0, ...]

If you like to learn how to read this point with code, refer to this tutorial: http://wiki.ros.org/pcl/Tutorials

Hi @jv00:@jvj00:

What you have here is a message of type" sensor_msgs/PointCloud2.msg: Reference: http://docs.ros.org/en/noetic/api/sensor_msgs/html/msg/PointCloud2.html

# 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
uint32 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
uint8[] data         # Actual point data, size is (row_step*height)

bool is_dense        # True if there are no invalid points

Let's break it a little further: The header message is of type std_msgs/Header.msg

uint32 seq
time stamp
string frame_id

In your case: header: seq: 19 stamp: secs: 124 nsecs: 110000000

uint32 height
uint32 width

frame_id: "camera_depth_optical_frame" height: 480 width: 640

Then comes

PointField[] fields

PointField[] fields is of type sensor_msgs/PointField.msg

The sensor_msgs/PointField.msg is composed of:

# 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

In your case: fields: - name: "x" offset: 0 datatype: 7 count: 1 - name: "y" offset: 4 datatype: 7 count: 1 - name: "z" offset: 8 datatype: 7 count: 1

is_bigendian, point_step and row_step and is_dense are straight forward to understand.

Finally,

uint8[] data

data contains the Actual point data, size is (row_step*height) In your case: data: [0, 0, 192, 127, 0, 0, 192, 127, 0, 0, 192, 127, 0, 0, 0, 0, 178, 178, 178, 0, 0, 0, 0, 0, 0, 0, 0, ...]

If you like to learn how to read this point with code, refer to this tutorial: http://wiki.ros.org/pcl/Tutorials

Hi @jvj00:

What you have here is a message of type" sensor_msgs/PointCloud2.msg: Reference: http://docs.ros.org/en/noetic/api/sensor_msgs/html/msg/PointCloud2.html

# 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
uint32 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
uint8[] data         # Actual point data, size is (row_step*height)

bool is_dense        # True if there are no invalid points

Let's break it a little further: The header message is of type std_msgs/Header.msg

uint32 seq
time stamp
string frame_id

In your case: header: seq: 19 stamp: secs: 124 nsecs: 110000000

uint32 height
uint32 width

frame_id: "camera_depth_optical_frame" height: 480 width: 640

Then comes

PointField[] fields

PointField[] fields is of type sensor_msgs/PointField.msg

The sensor_msgs/PointField.msg is composed of:

# 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

In your case: fields: - name: "x" offset: 0 datatype: 7 count: 1 - name: "y" offset: 4 datatype: 7 count: 1 - name: "z" offset: 8 datatype: 7 count: 1

is_bigendian, point_step and row_step and is_dense are straight forward to understand.

Finally,

uint8[] data

data contains the Actual point data, size is (row_step*height) In your case: data: [0, 0, 192, 127, 0, 0, 192, 127, 0, 0, 192, 127, 0, 0, 0, 0, 178, 178, 178, 0, 0, 0, 0, 0, 0, 0, 0, ...]

If you like to learn how to read this point with code, refer to this tutorial: http://wiki.ros.org/pcl/Tutorials