当前位置:   article > 正文

速腾RS-16一天跑通在线LEGO-LOAM心得,一站式解决所有问题_rs_lidar跑lego_loam

rs_lidar跑lego_loam

一.环境配置

1.见上一篇博客,跑通RS_LIDAR_SDK,不需要转换VELODYNE格式。

二.LEGO-LOAM

1.github自己找源码,运行的时候有一个bug,见这篇文章解决,谢谢作者大大。3、速腾16线激光雷达RS-16 ----- 3D建图算法LeGO-LOAM的使用(Ubuntu18.04 + ROS Melodic)_legoloam实时建图_杰尼君的博客-CSDN博客

2.源码有问题不会改github找一下,直接解决

https://github.com/ZYCheng-coder/lego-loam-ws

需要修改的几个地方 注意一下:

  1. extern const string pointCloudTopic = "/rslidar_points"; // /velodyne_points
  2. extern const string imuTopic = "/imu/data";
  3. // Save pcd
  4. extern const string fileDirectory = "/tmp/";
  5. // Using velodyne cloud "ring" channel for image projection (other lidar may have different name for this channel, change "PointXYZIR" below)
  6. extern const bool useCloudRing = false; // if true, ang_res_y and ang_bottom are not used

这里要注意:直接使用的是雷达输出数据话题

其次要注意的是,不使用CloudRing 因为源码的点云格式是XYZIR

懂得都懂 不多解释

  1. // have "ring" channel in the cloud -- false
  2. if (useCloudRing == true)
  3. {
  4. pcl::fromROSMsg(*laserCloudMsg, *laserCloudInRing);
  5. if (laserCloudInRing->is_dense == false) {
  6. ROS_ERROR("Point cloud is not in dense format, please remove NaN points first!");
  7. ros::shutdown();
  8. }
  9. }

下面要注意的是launch文件:

懂得都懂,不多解释

  1. <launch>
  2. <!--- Sim Time -->
  3. <param name="/use_sim_time" value="false" />
  4. <!--- Run Rviz-->
  5. <node pkg="rviz" type="rviz" name="rviz" args="-d $(find lego_loam)/launch/test.rviz" />
  6. <!--- TF -->
  7. <node pkg="tf" type="static_transform_publisher" name="camera_init_to_map" args="0 0 0 1.570795 0 1.570795 /map /camera_init 10" />
  8. <node pkg="tf" type="static_transform_publisher" name="base_link_to_camera" args="0 0 0 -1.570795 -1.570795 0 /camera /base_link 10" />
  9. <!--- LeGO-LOAM -->
  10. <node pkg="lego_loam" type="imageProjection" name="imageProjection" output="screen">
  11. <param name="lidarType" type="string" value="rslidar" />
  12. </node>
  13. <node pkg="lego_loam" type="featureAssociation" name="featureAssociation" output="screen"/>
  14. <node pkg="lego_loam" type="mapOptmization" name="mapOptmization" output="screen"/>
  15. <node pkg="lego_loam" type="transformFusion" name="transformFusion" output="screen"/>
  16. </launch>

三.保存TUM格式轨迹

  1. std::ofstream foutC("/home/lwj/lego_second_txt/college.txt", std::ios::app);
  2. foutC.setf(std::ios::fixed, std::ios::floatfield);
  3. foutC.precision(6);
  4. foutC << laserOdometry2.header.stamp << " "
  5. << laserOdometry2.pose.pose.position.x << " "
  6. << laserOdometry2.pose.pose.position.y << " "
  7. << laserOdometry2.pose.pose.position.z << " "
  8. << laserOdometry2.pose.pose.orientation.x << " "
  9. << laserOdometry2.pose.pose.orientation.y << " "
  10. << laserOdometry2.pose.pose.orientation.z << " "
  11. << laserOdometry2.pose.pose.orientation.w << std::endl;
  12. foutC.close();

完美结束!

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小小林熬夜学编程/article/detail/519426
推荐阅读
相关标签
  

闽ICP备14008679号