Function mrpt::ros2bridge::pointCloud2ToObservation

Function Documentation

mrpt::obs::CObservationPointCloud::Ptr mrpt::ros2bridge::pointCloud2ToObservation(const sensor_msgs::msg::PointCloud2 &pts, const std::string &sensorLabel)

Convert a PointCloud2 message to CObservationPointCloud.

  • Picks the richest available point-map type (CGenericPointsMap > CPointsMapXYZIRT > CPointsMapXYZI > CSimplePointsMap)

  • Applies fixLivoxTimestampsIfNeeded() automatically.

  • The caller is responsible for filling sensorPose afterwards.

Returns:

nullptr if the point cloud lacks x/y/z fields.