(1)
# 添加Eigen头文件
include_directories( "/usr/include/eigen3" )
(2)
#include "sophus/so3.hpp"
#include "sophus/se3.hpp"
(3)
大量报错但都与SO3,SE3有关
error: missing template arguments before ‘SO3_R’ error: ‘SO3_R’ was not declared in this scope
error: missing template arguments before‘SO3_updated’
error: ‘templateclassSophus::SE3’ used without template arguments
…
SO3这种数据类型应该是不存在的,可以声明为Sophus::SO3d 或者 Sophus::SO3.
SE3同理
(4)
error: no matching function for call to ‘Sophus::SO3::SO3(int, int, double)’
Sophus::SO3d SO3_v( 0, 0, M_PI/2 ); // 亦可从旋转向量构造
似乎是这种构造方式没有了
(5)
cout<<"SO(3) from matrix: "<<SO3_R<<endl;
上面这个代码
error: no match for ‘operator<<’ (operand types are ‘std::basic_ostream<char>’ and ‘Sophus::SO3d’ {aka ‘Sophus::SO3<double>’})
修改成:
cout<<"SO(3) from matrix: "<<SO3_R.log()<<endl;
总之<
(6)
在CMakeLists.txt加入
target_link_libraries( useSophus ${Sophus_LIBRARIES} fmt)
应该要放到add_executable( useSophus useSophus.cpp )后面
不然会报这种错
CMake Error at CMakeLists.txt:4 (target_link_libraries):
Cannot specify link libraries for target “useSophus” which is not built by
this project.
ch4代码可以学习这篇,重复的内容、就不写了
在CMakeLists.txt中
# 为使用 sophus,您需要使用find_package命令找到它
find_package( Sophus REQUIRED )
include_directories( ${Sophus_INCLUDE_DIRS} )
target_link_libraries( 程序名 ${Sophus_LIBRARIES} fmt)
1.hat 为向量到反对称矩阵
Sophus::SO3d::hat(so3)
2.vee为反对称到向量
Sophus::SO3d::vee( Sophus::SO3d::hat(so3) )
3.增量扰动模型的更新
Eigen::Vector3d update_so3(1e-4, 0, 0); //假设更新量为这么多
Sophus::SO3d SO3_updated = Sophus::SO3d::exp(update_so3)*SO3_R;