g2o 中定义好的常用顶点类型

news/2024/9/28 12:15:00 标签: java, 开发语言

前言

        一般来说定义 Vertex 需要重写这几个函数

// 读盘、存盘函数,不需要进行读/写操作的话,仅仅声明一下就可以
virtual bool read(std::istream& is);
virtual bool write(std::ostream& os) const;

// 设置被优化顶点的初始值
virtual void setToOriginImpl();

// 顶点更新函数,用于优化过程中增量 的计算
virtual void oplusImpl(const number_t* update);

一、VertexSE2 : public BaseVertex<3, SE2>  

//***g2o源码 g2o/g2o/types/slam2d/vertex_se2.h ***//

// 2D 位姿顶点, (x,y,theta)
class G2O_TYPES_SLAM2D_API VertexSE2 : public BaseVertex<3, SE2> 


二、VertexSE3 : public BaseVertex<6, Isometry3> 

//***g2o源码 g2o/g2o/types/slam3d/vertex_se3.h ***//

// 欧式变换矩阵(4x4),状态由 6d 向量表示(x,y,z,qx,qy,qz),省略了四元数的w部分。
class G2O_TYPES_SLAM3D_API VertexSE3 : public BaseVertex<6, Isometry3>


三、VertexPointXY : public BaseVertex<2, Vector2>

//***g2o源码 g2o/g2o/types/slam2d/vertex_point_xy.h ***//

// 二维点
class G2O_TYPES_SLAM2D_API VertexPointXY : public BaseVertex<2, Vector2>


四、VertexPointXYZ : public BaseVertex<3, Vector3>

//*** g2o源码 g2o/g2o/types/slam3d/vertex_pointxyz.h ***//

// 三维空间中被跟踪的点
class G2O_TYPES_SLAM3D_API VertexPointXYZ : public BaseVertex<3, Vector3>


五、VertexSBAPointXYZ : public BaseVertex<3, Vector3>

//*** g2o源码 g2o/g2o/types/sba/types_sba.h ***//

// 三维空间中的点,主要用于 Bundle Adjustment,BA
class G2O_TYPES_SBA_API VertexSBAPointXYZ : public BaseVertex<3, Vector3>


六、VertexSE3Expmap : public BaseVertex<6, SE3Quat>

//*** g2o源码 g2o/g2o/types/sba/types_six_dof_expmap.h ***//
// SE(3)顶点,内部用变换矩阵参数化,外部用指数映射参数化

#ifndef G2O_SBA_VERTEXSE3EXPMAP_H
#define G2O_SBA_VERTEXSE3EXPMAP_H

#include "g2o/core/base_vertex.h"
#include "g2o/types/slam3d/se3quat.h"
#include "g2o_types_sba_api.h"

namespace g2o {

/**
 * \brief SE3 Vertex parameterized internally with a transformation matrix
 * and externally with its exponential map
 */
class G2O_TYPES_SBA_API VertexSE3Expmap : public BaseVertex<6, SE3Quat> {
 public:
  EIGEN_MAKE_ALIGNED_OPERATOR_NEW

  VertexSE3Expmap();

  bool read(std::istream& is);
  bool write(std::ostream& os) const;
  void setToOriginImpl();
  void oplusImpl(const number_t* update_);
};

}  // namespace g2o

#endif
//*** g2o源码 g2o/g2o/types/sba/types_six_dof_expmap.cpp ***//
#include "vertex_se3_expmap.h"

#include "g2o/stuff/misc.h"

namespace g2o {

VertexSE3Expmap::VertexSE3Expmap() : BaseVertex<6, SE3Quat>() {}

bool VertexSE3Expmap::read(std::istream& is) {
  Vector7 est;
  internal::readVector(is, est);
  setEstimate(SE3Quat(est).inverse());
  return true;
}

bool VertexSE3Expmap::write(std::ostream& os) const {
  return internal::writeVector(os, estimate().inverse().toVector());
}

void VertexSE3Expmap::setToOriginImpl() { _estimate = SE3Quat(); }

void VertexSE3Expmap::oplusImpl(const number_t* update_) {
  Eigen::Map<const Vector6> update(update_);
  setEstimate(SE3Quat::exp(update) * estimate());
}

}  // namespace g2o

 


七、VertexCam : public BaseVertex<6, SBACam>

//*** g2o源码 g2o/g2o/g2o/types/sba/vertex_cam.h ***//

// SBACam 顶点,(x,y,z,qw,qx,qy,qz)
// 状态由 6d 向量表示(x,y,z,qx,qy,qz),省略了四元数的w部分。qw 假设为正值,以避免在表示旋转时的歧义。
class G2O_TYPES_SBA_API VertexCam : public BaseVertex<6, SBACam>

八、VertexSim3Expmap : public BaseVertex<7, Sim3> 

//*** g2o源码 g2o/g2o/types/sim3/types_seven_dof_expmap.h ***//

// Sim(3)顶点,(x,y,z,qw,qx,qy,qz)
// 状态由 7d 向量表示(x,y,z,qx,qy,qz),省略了四元数的w部分。qw 假设为正值,以避免在表示旋转时的歧义
// 表示两个相机之间的相对变换
class G2O_TYPES_SIM3_API VertexSim3Expmap : public BaseVertex<7, Sim3>


 


http://www.niftyadmin.cn/n/5681080.html

相关文章

【x**3专享#2】编译 uboot 和 kernel 的文件结构

虚拟机交叉编译环境配置及内核编译步骤说明书 请先查看前篇文章内容 1. 获取虚拟机 IP 地址 打开虚拟机终端&#xff0c;执行以下命令查看虚拟机 IP 地址&#xff1a;ifconfig或者ip addr记录 eth0 或 ens33 等网络接口的 inet 后面的 IP 地址 2. 使用 Xftp 连接虚拟机 打开…

set和map结构的使用

个人主页&#xff1a;敲上瘾-CSDN博客 个人专栏&#xff1a;游戏、数据结构、c语言基础、c学习、算法 目录 一、序列式容器和关联式容器 二、set和multiset 1.insert 2.erase 3.find 4.count 三、map和mapmulti 1.pair 2.insert 3.find 4.operator[ ] 5.erase 6.lo…

后端学习路线

后端学习路线 一、编程语言 至少需要学习一门编程语言&#xff0c;建议学习JAVA和GO语言。 二、数据库 数据库分为关系型数据库和非关系型数据库&#xff0c;区别在于分关系型数据库常用于大数据&#xff0c;而非关系型数据库一般不在大数据方面使用。 关系型数据库&#x…

基于Java开发的(控制台)模拟的多用户多级目录的文件系统

多级文件系统 1 设计目的 为了加深对文件系统内部功能和实现过程的理解&#xff0c;设计一个模拟的多用户多级目录的文件系统&#xff0c;并实现具体的文件物理结构、目录结构以及较为完善的文件操作命令集。 2 设计内容 2.1系统操作 操作命令风格&#xff1a;本文件系统的…

图论(dfs系列) 9/27

一、二维网格图中探测环 题意: 给定一个二维数组grid,如果二维数组中存在一个环&#xff0c;处于环上的值都是相同的。返回true&#xff1b;如果不存在就返回false&#xff1b; 思路&#xff1a; 在以往的dfs搜索中&#xff0c;都是往四个方向去dfs&#xff1b;但是在这一道…

《凡人歌》中的IT职业启示录

《凡人歌》是由中央电视台、正午阳光、爱奇艺出品&#xff0c;简川訸执导&#xff0c;纪静蓉编剧&#xff0c;侯鸿亮任制片&#xff0c;殷桃、王骁领衔主演&#xff0c;章若楠、秦俊杰、张哲华、陈昊宇主演的都市话题剧 &#xff0c;改编自纪静蓉的小说《我不是废柴》。该剧于2…

SpringBoot的概述与搭建

目录 一.SpringBoot的概述 二.SpringBoot 特点 三.SpringBoot 的核心功能 3.1起步依赖 3.2自动配置 四.SpringBoot 开发环境构建 五.SpringBoot 配置文件 六.SpringBoot数据访问管理 七.springboot注解 八.springboot集成mybatis 九.springboot全局异常捕获与处理 一…

2024 maya的散布工具sppaint3d使用指南

目前工具其实可以分为三个版本 1 最老的原版 时间还是2011年的&#xff0c;只支持python2版的maya 2 作者python3更新版 后来作者看maya直到2022上还是没有类似好用方便的工具&#xff0c;于是更新到了2022版本 这个是原作者更新的2022版本&#xff0c;改成了python3&#…