Sophus 基本用法

[TOC]

1、李群李代数基础

2、指数与对数映射

3、李代数与对数映射

4、Sophus的基本使用方法

1、简介

Sophus 库是Strasdat 维护的 。Sophus 库支持SO(3) 和 SE(3),此外还含有二维运动 SO(2),SE(2) 以及相似变换 Sim(3) 的内容。它是直接在 Eigen 基础上开发的,不需要安装额外的依赖库。可以直接从 GitHub 上获取 Sophus,在代码目录 slambook/3rdparty 下也提供了 Sophus 源代码。

1
2
Eigen::Matrix3d和Sophus::Matrix3d
Eigen::Vector3d和Sophus::Vector3d

此外,为了方便说明SE(4)和se(4),Sophus库还typedef了Vector4d、Matrix4d、Vector6d和Matrix6d等,即:

1
2
3
4
Sophus::Vector4d
Sophus::Matrix4d
Sophus::Vector6d
Sophus::Matrix6d

2、安装

1
2
3
4
5
6
7
git clone https://github.com/strasdat/Sophus.git
cd Sophus
git checkout a621ff
mkdir build
cd build
cmake ..
make

使用

李代数so(3):Sophus::Vector3d //因为so(3)仅仅只是一个普通的3维向量

李代数se(3):Sophus::Vector6d //因为se(3)仅仅只是一个普通的6维向量

SO3构造函数

1
2
3
4
5
SO3 ();
SO3 (const SO3 & other);
explicit SO3 (const Matrix3d & _R);
explicit SO3 (const Quaterniond & unit_quaternion);
SO3 (double rot_x, double rot_y, double rot_z);

SE3的构造函数

1
2
3
4
5
SE3 ();
SE3 (const SO3 & so3,const Vector3d & translation);
SE3 (const Matrix3d & rotation_matrix,const Vector3d & translation);
SE3 (const Quaterniond & unit_quaternion,const Vector3d & translation_);
SE3 (const SE3 & other);

输出

尽管SO3对应于矩阵群,但是SO3在使用cout时是以so3形式输出的,输出的是一个3维向量

SE3在使用cout输出时输出的是一个6维向量,其中前3维为对应的so3的值,后3维为实际的平移向量t

se3在使用cout输出时输出的也是一个6维向量,但是其前3维为平移值ρ

(注意此时的ρ与SE3输出的t是不同的,t=Jρ,其中J是雅克比矩阵),后3维为其对应的so3.

SO3,so3,SE3,se3初始化和相互转化关系

1、转换关系图

image-20220708021937910

关于旋转矩阵,旋转向量和四元数的初始化和相互转换关系可以参考另一篇博文:http://blog.csdn.net/u011092188/article/details/77430988

参考资料

【SOPHUS库 学习笔记 1】 SOPHUS的安装与使用

# 一文详解四元数、欧拉角、旋转矩阵、轴角如何相互转换 wexin