Velodyne VLP16 등 LiDAR 센서는 PointCloud2 포맷을 출력한다. 이를 다루기 위해서는 Open3D, PCL 등의 포맷에 맞게 변경해줘야하는데, 이를 위하여 Docs를 기반으로 포맷을 해석해보자.

예제 : sensor_msgs.msg의 PointCloud2

image.png

PointCloud2는 위와 같이 이루어져 있으며, 다음 코드로 호출할 수 있다.

### header
print("msg.header : ", msg.header)

### height & width
print("msg.height : ", msg.height)
print("msg.width : ", msg.width)

### fields
print("msg.fields :\\n", msg.fields)

### properties
print("msg.is_bigendian : ", msg.is_bigendian)
print("msg.point_step : ", msg.point_step)
print("msg.row_step : ", msg.row_step)

### data ###
print(f"msg.data Point 0: {msg.data[0]}, {msg.data[4]} {msg.data[8]}")

###
print("msg.is_dense : ", msg.is_dense)

VLP-16의 실제 데이터를 출력해보면 다음과 같이 나타난다.

스크린샷 2025-10-29 02-55-26.png

각각을 해석해보자.

  1. Header

Header는 PointCloud의 정보를 나타낸다.

time format의 stamp 변수와

string의 frame_id를 가지고 있다.

  1. Height & Width

LiDAR 데이터에서 Height는 기본적으로 1이다.