Function ros2_ouster::toMsg(const pcl::PointCloud<ouster_ros::Point>&, const std::chrono::nanoseconds, const std::string&, const uint64_t)

Function Documentation

inline sensor_msgs::msg::PointCloud2 ros2_ouster::toMsg(const pcl::PointCloud<ouster_ros::Point> &cloud, const std::chrono::nanoseconds timestamp, const std::string &frame, const uint64_t override_ts)

Convert Pointcloud to ROS message format.

This function assumes the input cloud has its data in column major order but shaped improperly according to the LiDAR resulting in tiled columns across the rows of the in-memory data buffer. This data format is described more closely here: https://github.com/SteveMacenski/ros2_ouster_drivers/issues/52

This function converts the PCL type to a ROS type and the resulting ROS type will reorder the data in memory to be in row-major order consistent to the rows x cols shape of the LiDAR receiver array.

Parameters:
  • cloud[in] A PCL PointCloud containing Ouster point data as described above.

  • timestamp[in] The timestamp to put on the ROS message header

  • frame[in] The TF coordinate frame identifier to put on the ROS message header.

Returns:

A ROS PointCloud2 message of LiDAR data whose memory buffer is row-major ordered consistent to the shape of the LiDAR array.