zoukankan      html  css  js  c++  java
  • Ubuntu Codeblocks配置Eigen Sophus

    1.配置Eigen

    从网站http://eigen.tuxfamily.org/index.php?title=Main_Page

    下载Eigen的安装包,并解压。

    在codeblocks中的设置-编译器-全局编译器设置-搜索路径-编译器,添加解压后的Eigen安装包即可。

    编写简单的程序测试

     1 #include <iostream>
     2 #include <Eigen/Dense>
     3 #include <Eigen/Core>
     4 using namespace std;
     5 
     6 int main()
     7 {
     8     Eigen::Matrix3d m;
     9     m << 1,2,3,4,5,6,7,8,9;
    10     cout << m << endl;
    11     return 0;
    12 }

    编译运行查看结果。

    看起来字体比较小,这环境设置中切换为终端输出。

    终端中的输出为:

     2.配置Sophus

    在终端中输入

    git clone http://github.com/strasdat/Sophus.git

    cd Sophus/

    git checkout a621ff

    mkdir build

    cd build

    cmake ..

    make

    编译完成后

    • 1 将Sophus添加到搜索路径

    • 将build文件夹中的 libSophus.so添加到链接器设置中的链接库

    •  3 将build文件夹中的 libSophus.so复制到/usr/lib/x86_64-linux-gnu目录下,在/usr/lib/x86_64-linux-gnu文件夹打开终端输入

    $ sudo cp /home/kingbird/Sophus/build/libSophus.so libSophus.so

    写测试程序

    #include <iostream>
    #include <Eigen/Dense>
    #include <Eigen/Core>
    #include <Eigen/Geometry>
    #include "sophus/so3.h"
    #include "sophus/se3.h"
    
    using namespace std;
    
    int main()
    {
        Eigen::Matrix3d m;
        m << 1,2,3,4,5,6,7,8,9;
        cout << m << endl;
        Eigen::AngleAxisd A1(M_PI / 2, Eigen::Vector3d(0, 0, 1));
        Eigen::Matrix3d R1 = A1.matrix();
        Eigen::Quaterniond Q1(A1);
        Sophus::SO3 SO3_R(R1);
        cout << "SO(3) SO3_R from Matrix" << SO3_R << endl << endl;
        return 0;
    }

    输出结果

     配置完成。

  • 相关阅读:
    怎么在java 8的map中使用stream
    在java 8 stream表达式中实现if/else逻辑
    Lambda表达式最佳实践
    java并发Exchanger的使用
    java中functional interface的分类和使用
    java 8 Streams简介
    一篇文章让你彻底弄懂SSL/TLS协议
    基于口令的密码(PBE)
    更加安全的密钥生成方法Diffie-Hellman
    有关密钥的最全总结都在这了
  • 原文地址:https://www.cnblogs.com/skyturtle/p/9689735.html
Copyright © 2011-2022 走看看