Gazebo仿真一个Mid360平台并运行FastLio建图(接Z550仿真Mid360)

0 引言

使用设备及环境:虚拟机Ubuntu20.04+gazebo11+pcl1.10

1 仿真Mid360点云

接之前的ZD550仿真Mid360平台,之前的点云格式为pointcloud,而FastLio算法所需雷达点云格式为大疆自定义点云类型-CustomMsg,需要对之前的驱动文件进行修改,即对livox_laser_simulation/src下面的livox_points_plugin.cpp进行修改。

livox_points_plugin.cpp:

int argc = 0;
char **argv = nullptr;
auto curr_scan_topic = sdf->Get<std::string>("ros_topic");
ROS_INFO_STREAM("ros topic name:" << curr_scan_topic);
ros::init(argc, argv, curr_scan_topic);
rosNode.reset(new ros::NodeHandle);
rosPointPub = rosNode->advertise<sensor_msgs::PointCloud>("/scan", 5);
raySensor = _parent;
auto sensor_pose = raySensor->Pose();

可以看到代码中:rosPointPub = rosNode->advertise<sensor_msgs::PointCloud>("/scan", 5);仅发布了sensor_msgs::PointCloud类型的点云数据。

分别查看pointcloud和customMsg类型的点云数据格式
sensor_msgs/pointcloud:

std_msgs/Header header
geometry_msgs/Point32[] points
sensor_msgs/ChannelFloat32[] channels

livox_ros_driver/CustomMsg:

std_msgs/Header header
  uint32 seq
  time stamp
  string frame_id
uint64 timebase
uint32 point_num
uint8 lidar_id
uint8[3] rsvd
livox_ros_driver/CustomPoint[] points
  uint32 offset_time
  float32 x
  float32 y
  float32 z
  uint8 reflectivity
  uint8 tag
  uint8 line

为了能够发布 livox_ros_driver/CustomMsg类型点云,这部分代码主要参考其他博客:点云格式转换:将 ros PointCloud2格式数据转为livox CustomMsg格式-CSDN博客

修改代码如下:

(1)首先定义话题发布方livox_pub:

livox_pub = rosNode->advertise<livox_ros_driver::CustomMsg>(curr_scan_topic, 5);
  • 10
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

leida_花

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

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

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

打赏作者

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

抵扣说明:

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

余额充值