镭神16线激光雷达跑SC-LeGo-LOAM算法

news2024/12/28 5:02:37

link

一、运行环境

环境:ubutu18.04+ros:melodic+pcl:1.8+gtsam+metis

环境配置:

  • Eigen 3.3.4
  • PCL 1.8.1 (1.11不能用)
  • ceres 2.0.0
  • gtsam 4.0.0

雷达参数:
在这里插入图片描述

二、下载编译运行

已修改配置的源码文件,下载catkin_make即可跑通。

https://gitee.com/zhankun3280/lslidar_c16_lego_loam

首先,要注意的是SC-LeGo-LOAM和16线雷神激光雷达源码的版本不一样,源码也可能稍有区别。这里找的是修改之后能跑得通的两个版本。
还要注意雷达的IP,我配置的是192.168.0.200

git clone https://gitee.com/zhankun3280/lslidar_c16_lego_loam

catkin_make
roslaunch lslidar_c16_decoder lslidar_c16.launch --screen

roslaunch lego_loam run.launch

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

三、lslidar的相关修改

  • 首先LeGO-LOAM默认的接受的topic name是velodyne_points,点云的frame_id是velodyne。
  • 镭神驱动发布的topic name为lslidar_point_cloud,frame_id为laser_link。
  • 这里需要修改一下lslidar_c16.launch文件,remap一下topic name,再修改frame_id为velodyne。
<launch>
  <arg name="device_ip" default="192.168.0.200" />
  <arg name="msop_port" default="2368" />
  <arg name="difop_port" default="2369" />
  <arg name="return_mode" default="1" />
  <arg name="time_synchronization" default="false" />

<node pkg=“lslidar_c16_driver” type=“lslidar_c16_driver_node” name=“lslidar_c16_driver_node” output=“screen”>
<param name=“device_ip” value=“KaTeX parse error: Expected 'EOF', got '&' at position 19: …g device_ip)" /&̲gt; &lt;par…(arg msop_port)” />
<param name=“difop_port” value=“KaTeX parse error: Expected 'EOF', got '&' at position 19: …g difop_port)"/&̲gt; &lt;par…(arg return_mode)”/>
<param name=“time_synchronization” value=“$(arg time_synchronization)”/>
</node>

<node pkg=“lslidar_c16_decoder” type=“lslidar_c16_decoder_node” name=“lslidar_c16_decoder_node” output=“screen”>
<param name=“calibration_file” value=“KaTeX parse error: Expected 'EOF', got '&' at position 57: …_c16_db.yaml" /&̲gt; &lt;par…(arg return_mode)”/>
<param name=“degree_mode” value=“2”/>
<param name=“config_vert_file” value=“false”/>
<param name=“distance_unit” value=“0.25”/>
<param name=“time_synchronization” value=“$(arg time_synchronization)”/>
<param name=“scan_start_angle” value=“0.0”/>
<param name=“scan_end_angle” value=“36000.0”/>
<param name=“scan_num” value=“8”/>
<param name=“publish_scan” value=“false”/>
<remap from=“lslidar_point_cloud” to=“/velodyne_points” /> <!–add–>
</node>

</launch>

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41

由于镭神C16的驱动中对点云强度的定义是uint8_t类型,LOAM能接收的是float32类型,并且LOAM在运行时是根据采集的点云不停的计算来估计自身位置的,所以如果点云强度不匹配,会出现坐标轴baselink漂移的现象。(注意:由于没有惯导,在LOAM运行时,如果雷达前方出现不规则快速运动的物体,比如拿书快速扫,雷达坐标系都会出现漂移现象,所以建议利用传感器来获取位置信息,这是最稳妥的方法)。

将lslidar_c16/lslidar_c16_decoder/src/rawdata.cc 中的 数据类型修改为 PCL常用的点云处理数据类型 pcl::PointXYZI point 即可 ,修改后注释雷达输出的 ring 和 timestamp的两个话题.

                    pcl::PointXYZI point;
                    //VPoint point;
                <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token punctuation">(</span>azimuth_corrected_f <span class="token operator">&lt;</span> scan_start_angle_<span class="token punctuation">)</span> <span class="token operator">||</span> <span class="token punctuation">(</span>azimuth_corrected_f <span class="token operator">&gt;</span> scan_end_angle_<span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token keyword">continue</span><span class="token punctuation">;</span>
                <span class="token keyword">if</span> <span class="token punctuation">(</span>distance2 <span class="token operator">&gt;</span> max_distance_ <span class="token operator">||</span> distance2 <span class="token operator">&lt;</span> min_distance_<span class="token punctuation">)</span> <span class="token punctuation">{<!-- --></span>
                    point<span class="token punctuation">.</span>x <span class="token operator">=</span> NAN<span class="token punctuation">;</span>
                    point<span class="token punctuation">.</span>y <span class="token operator">=</span> NAN<span class="token punctuation">;</span>
                    point<span class="token punctuation">.</span>z <span class="token operator">=</span> NAN<span class="token punctuation">;</span>
                    point<span class="token punctuation">.</span>intensity <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span>
                    <span class="token comment">//point.lines = dsr;</span>
                    pointcloud<span class="token operator">-&gt;</span><span class="token function">at</span><span class="token punctuation">(</span><span class="token number">2</span> <span class="token operator">*</span> <span class="token keyword">this</span><span class="token operator">-&gt;</span>block_num <span class="token operator">+</span> firing<span class="token punctuation">,</span> dsr<span class="token punctuation">)</span> <span class="token operator">=</span> point<span class="token punctuation">;</span>
                <span class="token punctuation">}</span> <span class="token keyword">else</span> <span class="token punctuation">{<!-- --></span>
                    <span class="token keyword">if</span> <span class="token punctuation">(</span>cbMethod_<span class="token punctuation">)</span> <span class="token punctuation">{<!-- --></span>
                        point<span class="token punctuation">.</span>x <span class="token operator">=</span> distance2 <span class="token operator">*</span> cos_scan_altitude_caliration<span class="token punctuation">[</span>dsr<span class="token punctuation">]</span> <span class="token operator">*</span> cos_azimuth <span class="token operator">+</span>
                                  R1_ <span class="token operator">*</span> <span class="token function">cos</span><span class="token punctuation">(</span>arg_horiz_orginal<span class="token punctuation">)</span><span class="token punctuation">;</span>
                        point<span class="token punctuation">.</span>y <span class="token operator">=</span> <span class="token operator">-</span>distance2 <span class="token operator">*</span> cos_scan_altitude_caliration<span class="token punctuation">[</span>dsr<span class="token punctuation">]</span> <span class="token operator">*</span> sin_azimuth <span class="token operator">+</span>
                                  R1_ <span class="token operator">*</span> <span class="token function">sin</span><span class="token punctuation">(</span>arg_horiz_orginal<span class="token punctuation">)</span><span class="token punctuation">;</span>
                        point<span class="token punctuation">.</span>z <span class="token operator">=</span> distance2 <span class="token operator">*</span> sin_scan_altitude_caliration<span class="token punctuation">[</span>dsr<span class="token punctuation">]</span> <span class="token operator">+</span> <span class="token number">0.426</span> <span class="token operator">/</span> <span class="token number">100.f</span><span class="token punctuation">;</span>
                    <span class="token punctuation">}</span> <span class="token keyword">else</span> <span class="token punctuation">{<!-- --></span>
                        point<span class="token punctuation">.</span>x <span class="token operator">=</span> distance2 <span class="token operator">*</span> cos_scan_altitude_caliration<span class="token punctuation">[</span>dsr<span class="token punctuation">]</span> <span class="token operator">*</span> cos_azimuth<span class="token punctuation">;</span>
                        point<span class="token punctuation">.</span>y <span class="token operator">=</span> <span class="token operator">-</span>distance2 <span class="token operator">*</span> cos_scan_altitude_caliration<span class="token punctuation">[</span>dsr<span class="token punctuation">]</span> <span class="token operator">*</span> sin_azimuth<span class="token punctuation">;</span>
                        point<span class="token punctuation">.</span>z <span class="token operator">=</span> distance2 <span class="token operator">*</span> sin_scan_altitude_caliration<span class="token punctuation">[</span>dsr<span class="token punctuation">]</span><span class="token punctuation">;</span>
                    <span class="token punctuation">}</span>

                    point<span class="token punctuation">.</span>intensity <span class="token operator">=</span> intensity<span class="token punctuation">;</span>
                    <span class="token comment">//point.lines = dsr;</span>

                    pointcloud<span class="token operator">-&gt;</span><span class="token function">at</span><span class="token punctuation">(</span><span class="token number">2</span> <span class="token operator">*</span> <span class="token keyword">this</span><span class="token operator">-&gt;</span>block_num <span class="token operator">+</span> firing<span class="token punctuation">,</span> dsr<span class="token punctuation">)</span> <span class="token operator">=</span> point<span class="token punctuation">;</span>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28

四、SC-LeGO-LOAM的相关修改

(1)修改utility.h

extern const bool useCloudRing = false; // if true, ang_res_y and ang_bottom are not used

...

// leishen16
// lslidar_c16
extern const int N_SCAN = 16;
extern const int Horizon_SCAN = 2000;
extern const float ang_res_x = 0.18;
extern const float ang_res_y = 2.0;
extern const float ang_bottom = 15.0;
extern const int groundScanInd = 10;

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12

(2)修改imageproject.cpp

void copyPointCloud(const sensor_msgs::PointCloud2ConstPtr& laserCloudMsg){
cloudHeader <span class="token operator">=</span> laserCloudMsg<span class="token operator">-&gt;</span>header<span class="token punctuation">;</span>
<span class="token comment">// cloudHeader.stamp = ros::Time::now(); // Ouster lidar users may need to uncomment this line</span>
pcl<span class="token operator">::</span><span class="token function">fromROSMsg</span><span class="token punctuation">(</span><span class="token operator">*</span>laserCloudMsg<span class="token punctuation">,</span> <span class="token operator">*</span>laserCloudIn<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// Remove Nan points</span>
std<span class="token operator">::</span>vector<span class="token operator">&lt;</span><span class="token keyword">int</span><span class="token operator">&gt;</span> indices<span class="token punctuation">;</span>
pcl<span class="token operator">::</span><span class="token function">removeNaNFromPointCloud</span><span class="token punctuation">(</span><span class="token operator">*</span>laserCloudIn<span class="token punctuation">,</span> <span class="token operator">*</span>laserCloudIn<span class="token punctuation">,</span> indices<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// have "ring" channel in the cloud</span>
<span class="token keyword">if</span> <span class="token punctuation">(</span>useCloudRing <span class="token operator">==</span> <span class="token boolean">true</span><span class="token punctuation">)</span><span class="token punctuation">{<!-- --></span>
	pcl<span class="token operator">::</span><span class="token function">fromROSMsg</span><span class="token punctuation">(</span><span class="token operator">*</span>laserCloudMsg<span class="token punctuation">,</span> <span class="token operator">*</span>laserCloudInRing<span class="token punctuation">)</span><span class="token punctuation">;</span>
	<span class="token keyword">if</span> <span class="token punctuation">(</span>laserCloudInRing<span class="token operator">-&gt;</span>is_dense <span class="token operator">==</span> <span class="token boolean">false</span><span class="token punctuation">)</span> <span class="token punctuation">{<!-- --></span>
		<span class="token function">ROS_ERROR</span><span class="token punctuation">(</span><span class="token string">"Point cloud is not in dense format, please remove NaN points first!"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
		ros<span class="token operator">::</span><span class="token function">shutdown</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
	<span class="token punctuation">}</span>  
<span class="token punctuation">}</span>

}

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17

注释掉cloudHeader.stamp = ros::Time::now()

五、离线建图

# 运行 lego-loam
roslaunch lego_loam run.launch

# 播放 指定的rosbag
rosbag play *.bag --clock --topic /velodyne_points /imu/data
rosbag play *.bag --clock /lslidar_point_cloud:=/velodyne_points

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

如果没有用到imu,就只订阅雷达话题。虽然 /imu/data 是可选的,但如果提供的话,它可以大大提高估计的准确性。

六、实时在线建图

<param name="/use_sim_time" value="false" />

 
 
  • 1

参考链接:
[1] 镭神16线雷达适配Lego-Loam开源框架
[2] 32线镭神雷达跑LeGO-LOAM:3D 激光SLAM
[3] LeGO-LOAM初探:原理,安装和测试
[4] 搭建实验室3d slam 移动小车 4.1jackal小车+镭神32线激光雷达lego-loam建图

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1152670.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

【idea】生成banner.txt

Spring Boot banner在线生成工具&#xff0c;制作下载英文banner.txt&#xff0c;修改替换banner.txt文字实现自定义&#xff0c;个性化启动banner-bootschool.netSpring Boot banner工具实现在线生成banner&#xff0c;轻松修改替换实现自定义banner&#xff0c;让banner.txt文…

谈API接入必须了解的各大API调用电商API应用场景

哪些业务场景可以使用API接口&#xff1f; &#xff08;1&#xff09;爬虫业务&#xff1a;在爬虫业务中&#xff0c;使用API接口可以帮助解决IP限制、反爬虫策略等问题&#xff0c;提高爬取数据的效率和稳定性。 &#xff08;2&#xff09;网络安全&#xff1a;在网络安全领…

CB2-2CARD的openSUSE远程SSH登录提示优化

CB2-2CARD的openSUSE远程SSH登录提示优化 1. 源由2. 优化内容2.1 去掉Password/banner前后的prompts提示语句2.2 增加logo登录界面2.3 增加系统运行情况简单汇报2.4 增加banner 3. 优化效果 1. 源由 之前运行的CB2-2CARD的openSUSE安装&NAS环境配置服务器已经运行也有段时…

POI实现省市级联(二级下拉框)

POI实现省市级联&#xff08;二级下拉框&#xff09; POI级联下拉框 直接上代码测试结果参考文章 POI级联下拉框 业务上经常会用到POI做Excel的导出&#xff0c;有时导出需求比较复杂&#xff0c;这里记录一下自己参考网上大神的水月境的博文完成的一个导出Excel省市级连下拉…

语雀故障与反思,顺便再领半年会员!

23 日语雀的故障相信大部分人都已经知道了&#xff0c;官方发布的公告是这样的&#xff1a; 10 月 23 日语雀出现重大服务故障&#xff0c;且持续 7 个多小时才完全恢复&#xff0c;给用户使用造成极大不便&#xff0c;对此我们深感抱歉。经过复盘&#xff0c;我们在这里向大家…

电脑数据文件恢复工具easyrecovery14中文版

当不小心将回收站的文件删除了怎么办&#xff1f;想找回但是不知道怎么找回需要的数据文件&#xff1f;别担心今天小编就为大家介绍一款非常专业的电脑数据文件恢复工具&#xff0c;easyrecovery14是由Ontrack专为电脑用户推出的一款专业的数据恢复软件&#xff0c;这款软件功能…

一道简单的C#面试题

试题&#xff1a; 抽顺序问题&#xff1a;有10位面试者&#xff0c;需要随机抽号面试。 1&#xff09;总共十个号数&#xff0c;用数组表示&#xff1b; 2&#xff09;每一位面试者输入1开始抽签&#xff0c;然后得到抽签号&#xff0c;输入2结束抽签&#xff1b; 3&#x…

(4) OpenCV图像处理SVM算法

一、介绍 考虑下面的图像,它具有两种数据类型,红色和蓝色。我们找到一条线f(x)=ax1+bx2+cf(x)=ax1+bx2+c,它将两条数据都分为两个区域。当我们得到一个新的test_data XX时,只需将其替换为f(x)f(x)即可。如果f(X)>0f(X)>0,则属于蓝色组,否则属于红色组。我们可以将此…

【QML】QML使用C++自定义组件,动态链接库DLL构建及使用

1. 方法1 &#xff08;C源码&#xff09; 1.1 创建一个普通的qml工程&#xff0c;写入ListView测试代码 import QtQuick 2.15 import QtQuick.Window 2.15Window {width: 640height: 500visible: truetitle: qsTr("Hello World")ListView{id:lvwidth: 100height: 5…

使用Llama index构建多代理 RAG

检索增强生成(RAG)已成为增强大型语言模型(LLM)能力的一种强大技术。通过从知识来源中检索相关信息并将其纳入提示&#xff0c;RAG为LLM提供了有用的上下文&#xff0c;以产生基于事实的输出。 但是现有的单代理RAG系统面临着检索效率低下、高延迟和次优提示的挑战。这些问题在…

第65讲:MySQL存储过程之循环语法的核心概念与应用案例

文章目录 1.存储过程中循环的种类2.WHILE循环控制2.1.WHILE循环语法格式2.2.WHILE循环经典案例 3.REPEAT循环控制3.1.REPEAT循环语法结构3.2.REPEAT循环经典案例 4.LOOP循环控制4.1.LOOP循环语法结构4.2.LOOP循环经典案例一4.3.LOOP循环经典案例二 1.存储过程中循环的种类 在存…

git 撤销已经push到远程的提交

git 撤销已经push到远程的提交 1. 情景2. 解决方法2.1 git revert2.2 git reset 1. 情景 工作中会有很多时候提交git的时候会提交错东西&#xff0c;而且已经push到远程的话怎么办呢&#xff1f; 2. 解决方法 2.1 git revert 一种常见的方法是使用 git revert 命令来创建一…

酷开科技,让家庭更有温度!

生活中总有一些瞬间&#xff0c;会让我们感到无比温暖和幸福。一个拥抱、一句问候、一杯热茶&#xff0c;都能让我们感受到家庭的温馨和关爱。酷开科技也用自己的方式为我们带来了独属于科技的温暖&#xff0c;通过全新的体验将消费者带进一个充满惊喜的世界&#xff0c;让消费…

iPhone无法关机未必是坏了!如何修复无法关闭的iPhone

iPhone运行很慢且发热是一个比较罕见的情况&#xff0c;但如果它发生在你身上&#xff0c;下面解释了发生的原因以及你如何修复它。 iPhone无法关闭的原因 iPhone无法关闭的最可能原因是&#xff1a; 由于软件问题&#xff0c;它被冻结了。 睡眠/唤醒按钮坏了。 屏幕坏了&a…

【Redis】环境配置

环境配置 Linux版本&#xff1a; Ubuntu 22.04.2 LTS 下载redis sudo apt install redis 启动redis redis-server 输入redis-server启动redis竟然报错了&#xff0c;原因是redis已经启动&#xff0c;网上大多数的解决方案如下&#xff1a; ps -ef | grep -i redis 查询redi…

软件开发项目文档系列之六概要设计:构建可靠系统的蓝图

概要设计是软件开发项目中至关重要的阶段&#xff0c;它为整个系统提供了设计蓝图和技术方向。它的重要性在于明确项目目标、规划系统结构、确定技术选择、识别风险、以及为团队提供共同的视角&#xff0c;确保项目在后续开发阶段按计划进行。概要设计的主要内容包括项目的背景…

九州未来入选“2023边缘计算产业图谱”三大细分领域

10月26日&#xff0c;边缘计算社区正式发布《2023边缘计算产业图谱》&#xff0c;九州未来凭借深厚的技术积累、优秀的产品服务、完善的产品解决方案体系以及开源贡献&#xff0c;实力入选图谱——边缘计算平台、边缘计算开源、边缘云服务提供商三大细分领域&#xff0c;充分彰…

统信UOS1060上修改sudo权限

原文链接&#xff1a;统信UOS1060上修改sudo权限 hello&#xff0c;大家好啊&#xff0c;今天给大家带来在统信UOS桌面操作系统1060上修改管理员权限&#xff0c;使其在使用sudo的时候&#xff0c;不要输入本用户密码验证的文章&#xff0c;主要通过修改 /etc/sudoers文件实现&…

恒驰服务 | 华为云数据使能专家服务offering之大数据建设

恒驰大数据服务主要针对客户在进行智能数据迁移的过程中&#xff0c;存在业务停机、数据丢失、迁移周期紧张、运维成本高等问题&#xff0c;通过为客户提供迁移调研、方案设计、迁移实施、迁移验收等服务内容&#xff0c;支撑客户实现快速稳定上云&#xff0c;有效降低时间成本…