lego-loam加入imu数据建图,使用自己的数据集建图

2023-05-16

配置lego-loam教程:

https://blog.csdn.net/qq_35102059/article/details/122671432?spm=1001.2014.3001.5501

激光雷达与imu的外参标定教程:

https://blog.csdn.net/qq_35102059/article/details/122577644?spm=1001.2014.3001.5501

lego-loam默认可以没有imu信息,但有imu建图效果会更好

配置跑通lego-loam后,进行外参标定,得到标定结果.

开始修改程序参数:

utility.h文件:

确认utility.h文件中imu的话题名称是否正确:

extern const string imuTopic = "/imu/data";

featureAssociation.cpp文件:

1. 私有成员加入3个转换变量:

class FeatureAssociation{

private:
    ...
    ...
    ...
    Eigen::Matrix3d extRot;
    Eigen::Matrix3d extRPY;
    Eigen::Quaterniond extQRPY;
public:
    ...

2.nh("~")函数中加入标定好的外参旋转矩阵:

nh("~")
        {
			// extRot << 1, 0, 0,
			// 					0, -1, 0,
			// 					0, 0, -1;
			// extRPY << 1, 0, 0,
			// 					0, -1, 0,
			// 					0, 0, -1;
            extRot <<     -0.2424,   -0.937885,   -0.248224,
                                -0.44903,   -0.118344,    0.885645, 
                                -0.860008,     0.32614,   -0.392452;
            extRPY <<     -0.2424,   -0.937885,   -0.248224,
                                -0.44903,   -0.118344,    0.885645, 
                                -0.860008,     0.32614,   -0.392452;
			extQRPY = Eigen::Quaterniond(extRPY);

        subLaserCloud = nh.subscribe<sensor_msgs::PointCloud2>("/segmented_cloud", 1, &FeatureAssociation::laserCloudHandler, this);
        subLaserCloudInfo = nh.subscribe<cloud_msgs::cloud_info>("/segmented_cloud_info", 1, &FeatureAssociation::laserCloudInfoHandler, this);
        subOutlierCloud = nh.subscribe<sensor_msgs::PointCloud2>("/outlier_cloud", 1, &FeatureAssociation::outlierCloudHandler, this);
        subImu = nh.subscribe<sensor_msgs::Imu>(imuTopic, 50, &FeatureAssociation::imuHandler, this);

        pubCornerPointsSharp = nh.advertise<sensor_msgs::PointCloud2>("/laser_cloud_sharp", 1);
        pubCornerPointsLessSharp = nh.advertise<sensor_msgs::PointCloud2>("/laser_cloud_less_sharp", 1);
        pubSurfPointsFlat = nh.advertise<sensor_msgs::PointCloud2>("/laser_cloud_flat", 1);
        pubSurfPointsLessFlat = nh.advertise<sensor_msgs::PointCloud2>("/laser_cloud_less_flat", 1);

        pubLaserCloudCornerLast = nh.advertise<sensor_msgs::PointCloud2>("/laser_cloud_corner_last", 2);
        pubLaserCloudSurfLast = nh.advertise<sensor_msgs::PointCloud2>("/laser_cloud_surf_last", 2);
        pubOutlierCloudLast = nh.advertise<sensor_msgs::PointCloud2>("/outlier_cloud_last", 2);
        pubLaserOdometry = nh.advertise<nav_msgs::Odometry> ("/laser_odom_to_init", 5);
        
        initializationValue();
}

3.紧跟着下面写一个外参转换函数:

sensor_msgs::Imu imuConverter(const sensor_msgs::Imu& imu_in)
{
    sensor_msgs::Imu imu_out = imu_in;
    // rotate acceleration
    Eigen::Vector3d acc(imu_in.linear_acceleration.x, imu_in.linear_acceleration.y, imu_in.linear_acceleration.z);
    acc = extRot * acc;
    imu_out.linear_acceleration.x = acc.x();
    imu_out.linear_acceleration.y = acc.y();
    imu_out.linear_acceleration.z = acc.z();
    // rotate gyroscope
    Eigen::Vector3d gyr(imu_in.angular_velocity.x, imu_in.angular_velocity.y, imu_in.angular_velocity.z);
    gyr = extRot * gyr;
    imu_out.angular_velocity.x = gyr.x();
    imu_out.angular_velocity.y = gyr.y();
    imu_out.angular_velocity.z = gyr.z();
    // rotate roll pitch yaw
    Eigen::Quaterniond q_from(imu_in.orientation.w, imu_in.orientation.x, imu_in.orientation.y, imu_in.orientation.z);
    Eigen::Quaterniond q_final = q_from * extQRPY;
    imu_out.orientation.x = q_final.x();
    imu_out.orientation.y = q_final.y();
    imu_out.orientation.z = q_final.z();
    imu_out.orientation.w = q_final.w();

    if (sqrt(q_final.x()*q_final.x() + q_final.y()*q_final.y() + q_final.z()*q_final.z() + q_final.w()*q_final.w()) < 0.1)
    {
        ROS_ERROR("Invalid quaternion, please use a 9-axis IMU!");
        ros::shutdown();
    }

    return imu_out;
}

4.在imu的回调函数第一行加入调用转换函数,完成转换:

void imuHandler(const sensor_msgs::Imu::ConstPtr& imuIn)
{
        sensor_msgs::Imu thisImu = imuConverter(*imuIn);  //就加这1行

    double roll, pitch, yaw;
    tf::Quaternion orientation;
    tf::quaternionMsgToTF(thisImu.orientation, orientation);
    tf::Matrix3x3(orientation).getRPY(roll, pitch, yaw);

注:

1.此外参为imu与激光雷达的标定结果中的旋转矩阵.

2.lego-loam中只考虑了imu到激光雷达的旋转,没有考虑平移(个人理解是,与小车的运动模型有关),故应该尽量将imu安装在激光雷达的正下方.

保存重新catkin_make编译.即可开始运行程序建图:

 

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

lego-loam加入imu数据建图,使用自己的数据集建图 的相关文章

  • 学习Kalibr工具--Camera与IMU联合标定过程

    上一节介绍了 xff0c 用kalibr工具对camera进行标定的操作流程 xff0c 在camera标定之好之后 xff0c 进行camera与IMU进行联合标定的操作的学习 xff0c 即求取相机和IMU 之间的转换关系 坐标系之间的
  • VINS slam , imu fusion

    VINS 基本介绍 VINS Mono 和 VINS Mobile 是香港科技大学沈劭劼老师开源的单目视觉惯导 SLAM 方案 2017年发表于 IEEE Transactions on Robotics 另外 xff0c VINS 的最新
  • Kalibr 之 Camera-IMU 标定 (总结)

    Overview 欢迎访问 持续更新 xff1a https cgabc xyz posts db22c2e6 ethz asl kalibr is a toolbox that solves the following calibrati
  • ROS2中IMU话题的发布及可视化

    环境 xff1a Ubuntu 20 04 xff0c ROS2 Foxy 传感器 xff1a 维特智能BWT901CL 代码是从维特智能的示例代码修改的 xff0c 实现基本的加速度 角速度和角度读取 xff0c 发布IMU消息 这个传感
  • Ubuntu18下xsens IMU的驱动安装及使用imu_utils标定

    最近在做xsens IMU的标定工作 xff0c 网上资源很多很杂 xff0c 打算按自己的操作过程 细节及遇到的问题记录一下 xff0c 里面有参考的博文都附了链接 主体可参考此博文 xff1a VIO 中 IMU 的标定流程 1 3 i
  • 传统定位方法简介--------里程计、IMU惯性传感器以及光电编码器等

    移动机器人最初是通过自身携带的内部传感器基于航迹推算的方法进行定位 xff0c 后来进一步发展到通过各种外部传感器对环境特征进行观测从而计算出移动机器人相对于整个环境的位姿 目前为止 xff0c 形成了基于多传感器信息融合的定位方法 现有移
  • 飞控IMU数据进阶处理(FFT,滤波器)

    前面的文章 xff08 知乎专栏 https zhuanlan zhihu com c 60591778 xff09 曾简单讲过IMU数据 xff08 陀螺仪 加速度数据 xff09 的校准以及一阶低通滤波 本文在此基础上更进一步讲一下数据
  • Camera-IMU联合标定原理

    Camera IMU联合标定原理 一 相机投影模型二 IMU 模型三 Camera IMU标定模型 一 相机 IMU旋转 二 相机 IMU平移 三 视觉惯性代价函数 四 camera imu联合标定 一 粗略估计camera与imu之间时间
  • RealSenseD345I —— imu + camera标定

    目录 1 标定目的 2 标定准备 3 标定步骤 nbsp nbsp nbsp nbsp 1 IMU标定 nbsp nbsp nbsp
  • Xsens Mti-g-710 IMU driver在Ubuntu18.04 ROS melodic中的安装使用

    Ubuntu18 04下安装的ROS melodic 如何使用Xsens Mti g 710 IMU driver xff1f 这里给出一个详细步骤说明 这里的IMU是USB接口 1安装 首先插入IMU的USB口 命令行运行 gt lsus
  • IMU校正以及姿态融合

    本文为博主 声时刻 原创文章 xff0c 未经博主允许不得转载 联系方式 xff1a shenshikexmu 64 163 com 缘起 有缘在简极科技兼职两年 接触了IMU xff0c 我去的时候那家公司还是一个要把IMU放进足球的公司
  • 49、OAK测试官方的IMU模块和SpatialLocationCalculator节点

    基本思想 xff1a 不太懂IMU是干嘛的 xff0c 不像图像那么容易可视化 xff0c 参考官方demo的 xff0c 记录一下 xff0c 后续这篇需要补充 xff0c 参考的IMU的介绍 xff0c 原理不懂 xff0c 先占个坑
  • 运行LeGO-LOAM

    参考 链接 xff1a https blog csdn net weixin 39754100 article details 112186264 https blog csdn net NEU Ocean article details
  • IMU让无人机控制变得更轻松

    多翼无人机广泛应用于监视和侦察 航空摄影和测量 搜索和救援任务 通信中继和环境监测 目前无人机的手动控制大部分基于视觉反馈 xff0c 所以操作环境中的障碍物会造成干扰 因此 xff0c 需要其他感官反馈 xff0c 例如触觉 xff0c
  • 利用IMU数据来计算位移

    目标 xff1a 利用IMU测得的加速度信息来计算位移 xff0c 很简单假设是匀加速运动或是匀速运动都可以 xff0c 主要是看问题的背景来具体去确定运动模型 xff0c 这里我就取个简单的匀加速运动模型 学习过程 xff1a 1 了解I
  • 惯导(IMU)的使用

    提示 xff1a 和上一篇关于利用imu计算位移的文章相比 xff0c 这篇我对imu的理解应该是更加深刻了 目录 前言 一 imu调试 二 利用IMU计算旋转 1 引入库 2 读入数据 总结 前言 这次使用的imu和上一篇文章中所提到的i
  • SC-Lego-LOAM解析(上)

    文章目录 正文imageProjectionfeatureAssociationFeature Extraction 正文 SC Lego LOAM实际上应该并不对应某一篇特定的论文 xff0c 而是韩国KAIST在github开源的代码
  • SC-Lego-LOAM解析(中)

    上回说到经过连续帧间匹配 xff0c 激光odo给出来一个位姿估计 xff0c 但是是存在不断的误差的积累的 xff0c 需要与绝对的参考 xff08 地图 xff09 进行匹配 xff0c 以及进行回环检测和全局位姿优化 这也是正是map
  • Ardupilot IMU恒温控制代码学习

    目录 文章目录 目录 摘要 第一章原理图学习 第二章恒温代码学习 1 目标温度怎么设置 摘要 本节主要学习ardupilot的IMU恒温控制代码 采用的飞控是pixhawk v5 欢迎一起交流学习 第一章原理图学习
  • 使用C/C++编程控制LEGO EV3

    环境搭建 1 安装Eclipse 选择Eclipse IDE for C C Developers 网址 http www eclipse org downloads 2 安装c4ev3 网址 https c4ev3 github io 该

随机推荐