common_msgs/sensor_msgs/include/sensor_msgs/PointCloud2.h
2025-10-30 11:30:16 +07:00

35 lines
1.2 KiB
C++

#ifndef POINTCLOUD2_H
#define POINTCLOUD2_H
#include <cstdint>
#include <string>
#include <vector>
#include "std_msgs/Header.h"
#include "sensor_msgs/PointField.h"
namespace sensor_msgs
{
struct PointCloud2
{
std_msgs::Header header; // Thời gian và frame của dữ liệu
uint32_t height = 1; // Số hàng (1 nếu là point cloud 1D)
uint32_t width = 0; // Số lượng điểm trên mỗi hàng (tổng điểm = height * width)
std::vector<PointField> fields; // Thông tin layout của từng trường trong dữ liệu (vd: x, y, z, intensity,...)
bool is_bigendian = false; // true nếu dữ liệu lưu ở dạng big-endian
uint32_t point_step = 0; // Số byte cho mỗi điểm
uint32_t row_step = 0; // Số byte cho mỗi hàng
std::vector<uint8_t> data; // Dữ liệu nhị phân (raw bytes), kích thước = row_step * height
bool is_dense = false; // true nếu không có điểm NaN hoặc vô hiệu
PointCloud2() = default;
};
}
#endif // POINTCLOUD2_H