• 李代数和旋转矩阵及变换矩阵的转换关系


    李代数可以与李群相互转化

    Sophus::SO3 SO3;
    Eigen::Vector3d so3 = SO3.log();
    Sophus::SO3 SO3_R = Sophus::SO3::exp( so3 );

    但是Sophus::SO3 SO3;不能用于表示旋转矩阵,实际上他是旋转矩阵的向量形式,转化为旋转矩阵要通过

        // 使用对数映射获得它的李代数
        Eigen::Vector3d so3 = SO3_R.log();
        cout<<"so3 = "<<so3.transpose()<<endl;
        // hat 为向量到反对称矩阵
        cout<<"so3 hat=
    "<<Sophus::SO3::hat(so3)<<endl;
        // 相对的,vee为反对称到向量
        cout<<"so3 hat vee= "<<Sophus::SO3::vee( Sophus::SO3::hat(so3) ).transpose()<<endl; // transpose纯粹是为了输出美观一些

    同样的对于SE3,

    cout<<"SE3 updated = "<<endl<<SE3_updated.matrix()<<endl;
    SE3_updated.matrix()并不是变化矩阵T,要通过hat得到
       // 对SE(3)操作大同小异
        Eigen::Vector3d t(1,0,0);           // 沿X轴平移1
        Sophus::SE3 SE3_Rt(R, t);           // 从R,t构造SE(3)
        Sophus::SE3 SE3_qt(q,t);            // 从q,t构造SE(3)
        cout<<"SE3 from R,t= "<<endl<<SE3_Rt<<endl;
        cout<<"SE3 from q,t= "<<endl<<SE3_qt<<endl;
        // 李代数se(3) 是一个六维向量,方便起见先typedef一下
        typedef Eigen::Matrix<double,6,1> Vector6d;
        Vector6d se3 = SE3_Rt.log();
        cout<<"se3 = "<<se3.transpose()<<endl;
        // 观察输出,会发现在Sophus中,se(3)的平移在前,旋转在后.
        // 同样的,有hat和vee两个算符
        cout<<"se3 hat = "<<endl<<Sophus::SE3::hat(se3)<<endl;
        cout<<"se3 hat vee = "<<Sophus::SE3::vee( Sophus::SE3::hat(se3) ).transpose()<<endl;
        
        // 最后,演示一下更新
        Vector6d update_se3; //更新量
        update_se3.setZero();
        update_se3(0,0) = 1e-4d;
        Sophus::SE3 SE3_updated = Sophus::SE3::exp(update_se3)*SE3_Rt;
        cout<<"SE3 updated = "<<endl<<SE3_updated.matrix()<<endl;
  • 相关阅读:
    C# 空合并运算符 ??
    基于ASP.NET Core 创建 Web API
    使用 csc.exe 编译C#代码
    NPOI创建Excel批注
    http协议 put、delete请求asp.net mvc应用,报404错误
    visual studio清理nuget包缓存
    String.IsNullOrEmpty 与 String.IsNullOrWhiteSpace
    C# linq to xml 简单示例
    SQL Server修改表结构,不允许保存更改。
    SQL Server 分离与附加数据库
  • 原文地址:https://www.cnblogs.com/feifanrensheng/p/8974894.html
Copyright © 2020-2023  润新知