激光雷达点云格式对比与转换,速腾、Velodyne、Ouster

用途

用于不同开源代码的传感器接入


1、速腾聚创

2021年左右的RS-LIDAR系列,对应的老版本ROS包

struct MyPointType
{
  PCL_ADD_POINT4D;
  float intensity;
  uint16_t ring = 0;
  double timestamp = 0;
  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
} EIGEN_ALIGN16;

POINT_CLOUD_REGISTER_POINT_STRUCT(MyPointType,    //注册点类型宏
    (float ,x,x)
    (float ,y,y)
    (float ,z,z)
    (float ,intensity,intensity)
    (uint16_t ,ring,ring)
    (double ,timestamp,timestamp)
)

现在的RS-HELIOS系列,新版本ROS包。和上面的只差了反射率的数据格式,uint8_t

namespace rslidar_ros
{
  struct EIGEN_ALIGN16 Point
  {
    PCL_ADD_POINT4D;
    uint8_t intensity;
    uint16_t ring = 0;
    double timestamp = 0;
    EIGEN_MAKE_ALIGNED_OPERATOR_NEW
  };
} 
POINT_CLOUD_REGISTER_POINT_STRUCT(rslidar_ros::Point,
                                  (float, x, x)(float, y, y)(float, z, z)(uint8_t , intensity, intensity)(uint16_t, ring, ring)(double, timestamp, timestamp))

2、velodyne

我了解到的格式如下,不清楚对应的ROS版本

struct VelodynePointXYZIRT {
    PCL_ADD_POINT4D
    PCL_ADD_INTENSITY;
    uint16_t ring;
    float time;

    EIGEN_MAKE_ALIGNED_OPERATOR_NEW
} EIGEN_ALIGN16;

POINT_CLOUD_REGISTER_POINT_STRUCT (VelodynePointXYZIRT,
                                   (float, x, x)(float, y, y)(float, z, z)(float, intensity, intensity)
                                           (uint16_t, ring, ring)(float, time, time)
)
namespace velodyne_ros
{
  struct EIGEN_ALIGN16 Point
  {
    PCL_ADD_POINT4D;
    float intensity;
    float time;
    uint16_t ring;
    EIGEN_MAKE_ALIGNED_OPERATOR_NEW
  };
} // namespace velodyne_ros
POINT_CLOUD_REGISTER_POINT_STRUCT(velodyne_ros::Point,
                                  (float, x, x)(float, y, y)(float, z, z)(float, intensity, intensity)(float, time, time)(std::uint16_t, ring, ring))

3、Ouster

namespace ouster_ros
{
  struct EIGEN_ALIGN16 Point
  {
    PCL_ADD_POINT4D;
    float intensity;
    uint32_t t;
    uint16_t reflectivity;
    uint8_t ring;
    uint16_t ambient;
    uint32_t range;
    EIGEN_MAKE_ALIGNED_OPERATOR_NEW
  };
} // namespace ouster_ros

// clang-format off
POINT_CLOUD_REGISTER_POINT_STRUCT(ouster_ros::Point,
    (float, x, x)
    (float, y, y)
    (float, z, z)
    (float, intensity, intensity)
    // use std::uint32_t to avoid conflicting with pcl::uint32_t
    (std::uint32_t, t, t)
    (std::uint16_t, reflectivity, reflectivity)
    (std::uint8_t, ring, ring)
    (std::uint16_t, ambient, ambient)
    (std::uint32_t, range, range)
)

参考

自定义速腾激光雷达点云XYZIRT格式并调用PCL库进行滤波-CSDN博客

HViktorTsoi/rs_to_velodyne: A ros tool for converting Robosense pointcloud to Velodyne pointcloud format. (github.com)

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
以下是一个简单的代码示例,用于实时将镭神C16输出的点云格式转换Velodyne点云数据格式: ```c++ #include <ros/ros.h> #include <sensor_msgs/PointCloud2.h> #include <pcl_conversions/pcl_conversions.h> #include <pcl/io/pcd_io.h> #include <pcl/point_types.h> #include <pcl/point_cloud.h> ros::Publisher pub; void cloud_cb (const sensor_msgs::PointCloud2ConstPtr& input_cloud_msg) { // 将ROS点云消息转换为PCL点云格式 pcl::PointCloud<pcl::PointXYZI>::Ptr input_cloud (new pcl::PointCloud<pcl::PointXYZI>); pcl::fromROSMsg (*input_cloud_msg, *input_cloud); // 创建Velodyne点云数据格式点云 pcl::PointCloud<pcl::PointXYZI>::Ptr output_cloud (new pcl::PointCloud<pcl::PointXYZI>); // 将镭神C16点云数据格式转换Velodyne点云数据格式 for (size_t i = 0; i < input_cloud->points.size (); ++i) { pcl::PointXYZI point; point.x = input_cloud->points[i].x; point.y = input_cloud->points[i].y; point.z = input_cloud->points[i].z; point.intensity = input_cloud->points[i].intensity; point.ring = 0; // 需要计算或者赋值激光线束编号 point.timestamp = 0; // 需要计算或者赋值时间戳 output_cloud->points.push_back (point); } // 将转换后的Velodyne点云数据格式发布为ROS点云消息 sensor_msgs::PointCloud2 output_cloud_msg; pcl::toROSMsg (*output_cloud, output_cloud_msg); output_cloud_msg.header = input_cloud_msg->header; pub.publish (output_cloud_msg); } int main (int argc, char** argv) { // 初始化ROS节点 ros::init (argc, argv, "c16_to_velodyne"); // 创建ROS节点句柄 ros::NodeHandle nh; // 创建ROS订阅器,用于接收镭神C16输出的点云数据 ros::Subscriber sub = nh.subscribe<sensor_msgs::PointCloud2> ("/c16_point_cloud", 1, cloud_cb); // 创建ROS发布器,用于发布转换后的Velodyne点云数据 pub = nh.advertise<sensor_msgs::PointCloud2> ("/velodyne_points", 1); // 循环等待ROS事件 ros::spin (); return (0); } ``` 在上述代码中,首先通过使用`ros::Subscriber`订阅器订阅镭神C16输出的点云数据。然后,在回调函数`cloud_cb`中,将ROS点云消息转换为PCL点云格式,并使用循环遍历镭神C16点云数据格式的每一个点,将其转换Velodyne点云数据格式,并添加所需的属性,如激光线束编号和时间戳。最后,使用`ros::Publisher`发布器将转换后的Velodyne点云数据格式发布为ROS点云消息。需要注意的是,上述示例代码仅供参考,具体的实现可能需要根据实际情况进行调整和修改。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

可见一班

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值