SC-A-LOAM在aloam基础上添加了回环优化的代码运行

2023-05-16

知道aloam的朋友们知道这个代码是不包含回环检测的
而有大神们对此添加了sc回环检测
来试着改动一下这个代码

虽然大部分aloam本身的代码都没有改动
但经过博主我的精细对比发现了有如下不同

修改laserMapping.cpp文件

添加了 sensor_msgs::PointCloud2 laserCloudFullRes3Local相关的代码

在大概140多行
添加

ros::Publisher pubLaserCloudFullResLocal;

变成

PointType pointOri, pointSel;

ros::Publisher pubLaserCloudSurround, pubLaserCloudMap, pubLaserCloudFullRes, pubOdomAftMapped, pubOdomAftMappedHighFrec, pubLaserAfterMappedPath;
ros::Publisher pubLaserCloudFullResLocal;

nav_msgs::Path laserAfterMappedPath;

大概是880行左右,添加了

            sensor_msgs::PointCloud2 laserCloudFullRes3Local;
			pcl::toROSMsg(*laserCloudFullRes, laserCloudFullRes3Local);
			laserCloudFullRes3Local.header.stamp = ros::Time().fromSec(timeLaserOdometry);
			laserCloudFullRes3Local.header.frame_id = "/camera_init";
			pubLaserCloudFullResLocal.publish(laserCloudFullRes3Local);

代码为:

        sensor_msgs::PointCloud2 laserCloudMsg;
				pcl::toROSMsg(laserCloudMap, laserCloudMsg);
				laserCloudMsg.header.stamp = ros::Time().fromSec(timeLaserOdometry);
				laserCloudMsg.header.frame_id = "/camera_init";
				pubLaserCloudMap.publish(laserCloudMsg);
			}

			sensor_msgs::PointCloud2 laserCloudFullRes3Local;
			pcl::toROSMsg(*laserCloudFullRes, laserCloudFullRes3Local);
			laserCloudFullRes3Local.header.stamp = ros::Time().fromSec(timeLaserOdometry);
			laserCloudFullRes3Local.header.frame_id = "/camera_init";
			pubLaserCloudFullResLocal.publish(laserCloudFullRes3Local);

			int laserCloudFullResNum = laserCloudFullRes->points.size();
			for (int i = 0; i < laserCloudFullResNum; i++)
			{
				pointAssociateToMap(&laserCloudFullRes->points[i], &laserCloudFullRes->points[i]);
			}

在main函数中别忘了继续定义它在大概980行左右:
插入

	pubLaserCloudFullResLocal = nh.advertise<sensor_msgs::PointCloud2>("/velodyne_cloud_registered_local", 100);

最后变成:

	pubLaserCloudMap = nh.advertise<sensor_msgs::PointCloud2>("/laser_cloud_map", 100);

	pubLaserCloudFullRes = nh.advertise<sensor_msgs::PointCloud2>("/velodyne_cloud_registered", 100);
	pubLaserCloudFullResLocal = nh.advertise<sensor_msgs::PointCloud2>("/velodyne_cloud_registered_local", 100);

	pubOdomAftMapped = nh.advertise<nav_msgs::Odometry>("/aft_mapped_to_init", 100);

并且把大部分的print输出语句注释掉了,这都是小case

对于其他的cpp文件修改的部分主要是把print语句注释。

修改laserOdometry.cpp文件

68行地方
原aloam为

int skipFrameNum = 2;

而scaloam中为

int skipFrameNum = 5;

其实影响不大

修改scanRegistration.cpp文件

在第60行的位置,添加:

std::string LIDAR_TYPE;

变成

using std::atan2;
using std::cos;
using std::sin;

std::string LIDAR_TYPE;

const double scanPeriod = 0.1;

170行左右的位置对雷达的类型做了不同的定义

  if (LIDAR_TYPE == "VLP16" && N_SCANS == 16)
        {
            scanID = int((angle + 15) / 2 + 0.5);
            if (scanID > (N_SCANS - 1) || scanID < 0)
            {
                count--;
                continue;
            }
        }
        else if (LIDAR_TYPE == "HDL32" && N_SCANS == 32)
        {
            scanID = int((angle + 92.0/3.0) * 3.0 / 4.0);
            if (scanID > (N_SCANS - 1) || scanID < 0)
            {
                count--;
                continue;
            }
        }
        // HDL64 (e.g., KITTI)
        else if (LIDAR_TYPE == "HDL64" && N_SCANS == 64)
        {   
            if (angle >= -8.83)
                scanID = int((2 - angle) * 3.0 + 0.5);
            else
                scanID = N_SCANS / 2 + int((-8.83 - angle) * 2.0 + 0.5);

            // use [0 50]  > 50 remove outlies 
            if (angle > 2 || angle < -24.33 || scanID > 50 || scanID < 0)
            {
                count--;
                continue;
            }
        }
        // Ouster OS1-64 (e.g., MulRan)
        else if (LIDAR_TYPE == "OS1-64" && N_SCANS == 64)
        {   
            scanID = int((angle + 22.5) / 2 + 0.5); // ouster os1-64 vfov is [-22.5, 22.5] see https://ouster.com/products/os1-lidar-sensor/
            if (scanID > (N_SCANS - 1) || scanID < 0)
            {
                count--;
                continue;
            }
        }
        else
        {
            //printf("wrong scan number\n");
            ROS_BREAK();
        }
        printf("angle %f scanID %d \n", angle, scanID);

但其实我运行不出来,需要修改成自己的激光雷达相关的参数

else if (N_SCANS == 32)
        {
            //std::cout<<"N_scnas:"<<N_SCANS<<std::endl;
            scanID = int(((angle - 2.3125)/ 2.8125) + 0.5);
            //std::cout<<"angle:"<<angle<<std::endl;
            //std::cout<<"scanID:"<<scanID<<std::endl;
            if (scanID > (N_SCANS - 1) || scanID < 0)
            {
                count--;
                continue;
            }
        }

所以将32这部分进行修改

同时需要添加main中的内容

    nh.param<std::string>("lidar_type", LIDAR_TYPE, "KITTI");

当然也可以完全不修改,我只需要使用32线束

同时490行左右main函数内

    ros::Subscriber subLaserCloud = nh.subscribe<sensor_msgs::PointCloud2>("/velodyne_points", 100, laserCloudHandler);

需要根据自己的包内容进行修改,当然可以直接修改成包的话题名字

    ros::Subscriber subLaserCloud = nh.subscribe<sensor_msgs::PointCloud2>("/horizontal_laser_3d", 100, laserCloudHandler);

或者在launch文件中进行修改

 <remap from="/velodyne_points" to="horizontal_laser_3d"/>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

SC-A-LOAM在aloam基础上添加了回环优化的代码运行 的相关文章

随机推荐

  • Can‘t create directory ‘D:\develop erver\MySQL-8.0.20\data\‘ (OS errno 2 - No such file or director

    错误信息 MySQL8 0安装时遇到的异常 命令 xff1a mysqld initialize console 原因分析 xff1a 提示 xff1a 是因为设置mysql的安装目录和mysql数据库的数据的存放目录是反斜杠的问题 例如
  • Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile

    问题描述 Failed to execute goal org apache maven plugins maven compiler plugin 3 7 0 compile default compile on project xxx
  • 文本比对工具【UltraCompare附安装包】Mac和Windows下载使用

    UltraCompare 强大的文件 xff0c 文件夹 xff0c PDF Word和Excel比较 文件夹同步 xff0c 二进制 十六进制比较 下载一个免费的全功能试用版 xff0c 看看为什么 适用于Windows Mac和Linu
  • 面试问MongoDB和Redis有什么区别?

    MongoDB是一种文档型数据库 xff0c 它以JSON格式存储数据 它适合存储大量的复杂数据 xff0c 例如存储大量结构化数据的应用程序 它提供强大的查询功能和支持分布式部署 Redis则是一种基于内存的数据存储系统 xff0c 它适
  • 在MySQL中查看慢 SQL

    进入 MySQL 命令行工具 可以在终端输入 mysql u 用户名 p xff0c 然后输入密码来登录到 MySQL 输入以下命令开启慢查询日志 xff1a span class token keyword SET span span c
  • 怎么防止SQL注入?

    首先SQL注入是一种常见的安全漏洞 xff0c 黑客可以通过注入恶意代码来攻击数据库和应用程序 以下是一些防止SQL注入的基本措施 xff1a 数据库操作层面 使用参数化查询 xff1a 参数化查询可以防止SQL注入 xff0c 因为参数化
  • WARMING! ! ! BIOS Recovery mode has been detected. Please put the file “ASUS. CAp“ into HDD or a rem

    文章目录 问题场景 xff1a 解决方案 xff1a 步骤1 xff1a 下载适当的BIOS文件步骤2 xff1a 将BIOS文件复制到可移动设备或硬盘驱动器中步骤3 xff1a 进入BIOS恢复模式步骤4 xff1a 恢复BIOS步骤5
  • 如何比较本地git分支与其远程分支?

    如何查看本地分支和远程分支之间的diff xff1f 1楼 第一种 a href http www javaxxz com thread 377026 1 1 html git a branch a 获取可用分支列表 在输出上你可能会看到类
  • VuePress1.x使用及个人博客搭建

    文章目录 介绍快速开始安装目录页面配置 介绍 VuePress 由两部分组成 xff1a 一个以 Vue 驱动的主题系统的简约静态网站生成工具 xff0c 和一个为编写技术文档而优化的默认主题 它是为了支持 Vue 子项目的文档需求而创建的
  • Git项目同时推送到GitHub和Gitee详细操作

    文章目录 前言一 创建仓库 Create a new repository 二 初始化三 配置公钥四 密钥验证五 代码推送 总结 前言 将Git项目同时推送到GitHub和Gitee的好处如下 xff1a 提高代码可见性和协作性 xff1a
  • VMware虚拟机安装CentOS8详细教程

    文章目录 一 下载安装包二 创建虚拟机1 安装 VMware2 创建虚拟机3 编辑虚拟机设置 三 系统安装1 开始安装2 时区设置3 分区设置4 配置网络6 开机密码7 配置安装源8 安装 四 系统配置1 网络检查2 配置静态IP地址 一
  • ChatGPT API调用+服务器部署【附Git地址】

    文章目录 一 关键代码二 使用步骤1 获取代码2 服务器部署 总结 运行对话效果图 一 关键代码 span class token keyword public span span class token keyword class spa
  • zookeeper超详细安装集群部署

    文章目录 一 zookeeper官网下载二 JDK环境安装三 zookeeper安装1 zookeeper解压2 zookeeper配置文件介绍 克隆服务器1 网络检查2 集群配置3 启动集群4 错误记录 一 zookeeper官网下载 下
  • VMware虚拟机克隆、复制虚拟机

    文章目录 为什么要克隆一 环境检查二 开始克隆三 网卡静态配置 为什么要克隆 首先VMware 上创建的虚拟机是可以重复使用的 xff0c 安装好的虚拟机可以直接复制或者剪切到其它任意电脑上 xff0c 然后使用 VMware 打开使用 x
  • CentOS7【管理防火墙端口命令】

    查看防火墙状态 xff1a firewall span class token operator span cmd span class token operator span state 开启防火墙 xff1a systemctl sta
  • Package ‘ufw‘ has no installation candidate问题已解决

    错误提示 xff1a Reading package lists Done Building dependency tree Done Package aptitude is not available but is referred to
  • 用git下载单个分支

    原文发在github io博客 转载写明出处 xff1a http landerlyoung github io blog 2014 01 06 yong gitxia zai dan ge fen zhi 最近在玩octpress 开始一
  • ubuntu18 安装ros-melodic 的踩坑记录

    今天运行a loam程序才发现重装之后的ubuntu18没装ros 于是去查了怎么去查找ros系统的版本 先在终端输入roscore 打开新终端 xff0c 再输入 xff0c rosparam list 再输入rosparam get r
  • 二进制信号量和互斥量之间的区别

    二进制信号量和互斥量之间是否有任何区别 xff0c 或者它们基本相同 xff1f 1楼 它们的同步语义非常不同 xff1a 互斥锁允许序列化对给定资源的访问 xff0c 即多个线程一次等待一个锁 xff0c 并且如前所述 xff0c 该线程
  • SC-A-LOAM在aloam基础上添加了回环优化的代码运行

    知道aloam的朋友们知道这个代码是不包含回环检测的 而有大神们对此添加了sc回环检测 来试着改动一下这个代码 虽然大部分aloam本身的代码都没有改动 但经过博主我的精细对比发现了有如下不同 修改laserMapping cpp文件 添加