This is a sim(3) poses optimize with ceres solver and display with qt
$ sudo apt-get install libqglviewer-dev-qt5 -y
$ git clone https://github.com/strasdat/Sophus
$ cd Sophus
$ mkdir build
$ cd build
$ cmake ..
$ sudo make install
$ git clone https://github.com/b51/CeresSim3Optimize.git
$ cd CeresSim3Optimize
$ mkdir build
$ cd build
$ cmake ..
$ make -j
$ ./CeresSim3Optimize
click initial and choose sim3_sphere_data.g2o in data folder, then optimize
!!! Chrome extension TeX All the Things is neccessary for Latex below display !!!
1. With the property of Lie Algebra Adjoint, Reference
2. Baker-Campbell-Hausdorf equations, STATE ESTIMATION FOR ROBOTICS P.234
With
With$\hspace{1cm}B_0 = 1, B_1 = -\frac{1}{2}, B_2 = \frac{1}{6}, B_3 = 0, B_4 = -\frac{1}{30}\dots$,
3. Adjoint Matrix of sim(3)
a) Main property of adjoint matrix on Lie Algebras, Reference: LIE GROUPS AND LIE ALGEBRAS, 1.6
b) sim3 Lie Brackets, Reference: Local Accuracy and Global Consistency for Efficient Visual SLAM, P.184, A.3.4:
$$\mathbf{[x, y] = [\begin{bmatrix} \nu \newline \omega \newline \sigma\end{bmatrix} \begin{bmatrix} \tau \newline \varphi \newline \varsigma \end{bmatrix}] = \begin{bmatrix}\omega \times \tau + \nu \times \varphi + \sigma\tau - \varsigma\nu \newline \omega \times \varphi \newline 0 \end{bmatrix}}$$
$$\mathbf{= \begin{bmatrix}(\hat{\omega} + \sigma I)\tau + \nu \times \varphi - \varsigma\nu \newline \omega \times \varphi \newline 0 \end{bmatrix}}$$
We can get $\hspace{4cm}\mathbf{\xi^{\lambda} = adj(\xi) = \begin{bmatrix} (\hat{\omega} + \sigma I) & \hat{\nu} & -{\nu} \newline 0 & \hat{\omega} & 0 \newline 0 & 0 & 0 \end{bmatrix}}$
sim(3) update with Left multiplication/Right multiplication has affect on Jacobian calculation, Formula derivation below used Right multiplication as example
Derivation of
Same to
Code Reference: https://github.com/b51/CeresSim3Optimize
Define Plus method with Right multiplication in ceres Sim3LocalParameterization
class CERES_EXPORT Sim3Parameterization : public ceres::LocalParameterization {
public:
virtual ~Sim3Parameterization() {}
virtual bool Plus(const double* x,
const double* delta,
double* x_plus_delta) const;
virtual bool ComputeJacobian(const double* x,
double* jacobian) const;
virtual int GlobalSize() const { return 7; }
virtual int LocalSize() const { return 7; }
};
/**
* 该方法为定义的右乘更新,所以在计算 Jacobian 时也需要按照该方法进行更新
* 若是左乘更新,则 x_plus_delta_lie = (delta_S * S).log();
*/
bool Sim3Parameterization::Plus(const double* x,
const double* delta,
double* x_plus_delta) const {
Eigen::Map<const Eigen::Matrix<double, 7, 1>> lie(x);
Eigen::Map<const Eigen::Matrix<double, 7, 1>> delta_lie(delta);
Sophus::Sim3d S = Sophus::Sim3d::exp(lie);
Sophus::Sim3d delta_S = Sophus::Sim3d::exp(delta_lie);
Eigen::Matrix<double, 7, 1> x_plus_delta_lie(x_plus_delta);
x_plus_delta_lie= (S * delta_S).log();
return true;
}
/**
* 该方法为 Jacobian 计算方法,因为在 Ceres Costfunction 中已经定义了 jacobian 的
* 计算方法,所以这里设置为 Identity 矩阵就行
*/
bool Sim3Parameterization::ComputeJacobian(const double *x, double *jacobian) const {
ceres::MatrixRef(jacobian, 7, 7) = ceres::Matrix::Identity(7, 7);
return true;
}
- https://www.encyclopediaofmath.org/index.php/Adjoint_representation_of_a_Lie_group
- http://www.math.jhu.edu/~fspinu/423/7.pdf
- STATE ESTIMATION FOR ROBOTICS, P.234
- Local Accuracy and Global Consistency for Efficient Visual SLAM, P.184, A.3.4
- https://www.jianshu.com/p/efe0d10197ba
- https://blog.csdn.net/heyijia0327/article/details/51773578