Cartographer源码阅读(8):imu_tracker
1.个人资源索引2.SLAM学习笔记(1)基本概念3.SLAM学习笔记(2)SLAM算法4.[ROS]2 尝试编译OrbSLAM5.[ROS]1 小乌龟6.SLAM最近的工作7.SLAM学习笔记(3)相关概念8.[SLAM]2D激光线特征提取9.[SLAM] GMapping SLAM源码阅读(草稿)10.[QGLViewer]First Demo11.SLAM数据集12.[SLAM]2D激光扫描匹配方法13.[g2o]一个备忘14.[ROS] slam_gmapping15.[ROS]3 Linux编程练习16.Linux学习和ROS安装(1)17.小豆包的学习之旅:机器人定位18.小豆包的学习之旅:传感器观测模型19.Kinect2.0相机标定20.小豆包的学习之旅:里程计运动模型21.小豆包的学习之旅:入门篇22.Kinect2.0点云数据获取23.[硬件]Robot运动控制24.[硬件]Urg_viewer数据读取25.[硬件]三维点云数据获取26.Kinect2.0获取数据27.ndt histogram_direction28.rplidar & hector slam without odometry29.rplidar测试30.[原创]NDT方法在SLAM中的应用31.[SLAM]Karto SLAM算法学习(草稿)32.ROS学习备忘33.[ROS]激光驱动安装34.OrbSLAM2采集点云数据
35.Cartographer源码阅读(8):imu_tracker
36.[硬件]点云数据采集237.Cartographer源码阅读(9):图优化的前端——闭环检测38.Cartographer源码阅读(7):轨迹推算和位姿推算的原理39.Ethzasl MSF源码阅读(3):MSF_Core和PoseMeasurement40.Ethzasl MSF源码阅读(2):百川汇海41.Ethzasl MSF源码阅读(1):程序入口和主题订阅42.Cartographer源码阅读(6):LocalTrajectoryBuilder和PoseExtrapolator43.Cartographer源码阅读(5):PoseGraph位姿图44.Cartographer源码阅读(4):Node和MapBuilder对象245.Cartographer源码阅读(3):程序逻辑结构46.Cartographer源码阅读(2):Node和MapBuilder对象47.Cartographer源码阅读(1):程序入口48.实时Cartographer测试(1) - rplidar49.Cartographer安装50.ROS安装(2)51.[ROS]一些传感器数据读取融合问题的思考52.小豆包的学习之旅:占用概率栅格地图和cost-map53.小豆包的学习之旅:开发记录54.[概述]移动机器人自主探索55.MRPT编译IMU的输入为imu_linear_acceleration 和 imu_angular_velocity 线加速和角速度。最终作为属性输出的是方位四元数。
Eigen::Quaterniond orientation() const { return orientation_; }
1 /* 2 * Copyright 2016 The Cartographer Authors 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #include "cartographer/mapping/imu_tracker.h" 18 19 #include <cmath> 20 #include <limits> 21 22 #include "cartographer/common/math.h" 23 #include "cartographer/transform/transform.h" 24 #include "glog/logging.h" 25 26 namespace cartographer { 27 namespace mapping { 28 29 ImuTracker::ImuTracker(const double imu_gravity_time_constant, 30 const common::Time time) 31 : imu_gravity_time_constant_(imu_gravity_time_constant), 32 time_(time), 33 last_linear_acceleration_time_(common::Time::min()), 34 orientation_(Eigen::Quaterniond::Identity()), 35 gravity_vector_(Eigen::Vector3d::UnitZ()), 36 imu_angular_velocity_(Eigen::Vector3d::Zero()) {} 37 38 void ImuTracker::Advance(const common::Time time) { 39 CHECK_LE(time_, time); 40 const double delta_t = common::ToSeconds(time - time_); 41 const Eigen::Quaterniond rotation = 42 transform::AngleAxisVectorToRotationQuaternion( 43 Eigen::Vector3d(imu_angular_velocity_ * delta_t)); 44 orientation_ = (orientation_ * rotation).normalized(); 45 gravity_vector_ = rotation.conjugate() * gravity_vector_; 46 time_ = time; 47 } 48 49 void ImuTracker::AddImuLinearAccelerationObservation( 50 const Eigen::Vector3d& imu_linear_acceleration) { 51 // Update the 'gravity_vector_' with an exponential moving average using the 52 // 'imu_gravity_time_constant'. 53 const double delta_t = 54 last_linear_acceleration_time_ > common::Time::min() 55 ? common::ToSeconds(time_ - last_linear_acceleration_time_) 56 : std::numeric_limits<double>::infinity(); 57 last_linear_acceleration_time_ = time_; 58 const double alpha = 1. - std::exp(-delta_t / imu_gravity_time_constant_); 59 gravity_vector_ = 60 (1. - alpha) * gravity_vector_ + alpha * imu_linear_acceleration; 61 // Change the 'orientation_' so that it agrees with the current 62 // 'gravity_vector_'. 63 const Eigen::Quaterniond rotation = Eigen::Quaterniond::FromTwoVectors( 64 gravity_vector_, orientation_.conjugate() * Eigen::Vector3d::UnitZ()); 65 orientation_ = (orientation_ * rotation).normalized(); 66 CHECK_GT((orientation_ * gravity_vector_).z(), 0.); 67 CHECK_GT((orientation_ * gravity_vector_).normalized().z(), 0.99); 68 } 69 70 void ImuTracker::AddImuAngularVelocityObservation( 71 const Eigen::Vector3d& imu_angular_velocity) { 72 imu_angular_velocity_ = imu_angular_velocity; 73 } 74 75 } // namespace mapping 76 } // namespace cartographer
作者:太一吾鱼水
文章未经说明均属原创,学习笔记可能有大段的引用,一般会注明参考文献。
欢迎大家留言交流,转载请注明出处。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· Vue3状态管理终极指南:Pinia保姆级教程
2013-03-21 AE开发三维的不足!
2012-03-21 HashTable与Dictionary