fast-LIVO安装测试

在尝试安装FAST-LIVO项目时,按照GitHub的readme指示进行,但在安装Sophus依赖时遇到问题。具体是Sophus的SO2构造函数中出现lvaluerequiredasleftoperandofassignment的错误。为了解决这个问题,需要按照博客中的建议修改源码,将行32和33的赋值操作改为使用括号,即unit_complex_.real(1.);unit_complex_.imag(0.);。这样修改后,可以成功编译并继续安装过程。
摘要由CSDN通过智能技术生成

安装:

跟着readme就可以

GitHub - hku-mars/FAST-LIVO: A Fast and Tightly-coupled Sparse-Direct LiDAR-Inertial-Visual Odometry.

但安装Sophus要求使用非模板类版本,下载作者推荐得make时会有报错:

/home/zf/LIBS/Sophus/sophus/so2.cpp:32:26: error: lvalue required as left operand of assignment
   32 |   unit_complex_.real() = 1.;
      |                          ^~
/home/zf/LIBS/Sophus/sophus/so2.cpp:33:26: error: lvalue required as left operand of assignment
   33 |   unit_complex_.imag() = 0.;
      |  

参照下文:fatal error: sophus/se3.h: 没有那个文件或目录_古路的博客-CSDN博客

将相关代码改掉即可。

#so2.cpp的构造函数改掉:
//unit_complex_.real() = 1.;
//unit_complex_.imag() = 0.;
unit_complex_.real(1.); 
unit_complex_.imag(0.);

编译有包依赖Sophus时,报错:

/usr/bin/ld: /home/zf/ROS_PROJECT2/devel/lib/libvikit_common.so: undefined reference to `Sophus::SE3::exp(Eigen::Matrix<double, 6, 1, 0, 6, 1> const&)'
/usr/bin/ld: /home/zf/ROS_PROJECT2/devel/lib/libvikit_common.so: undefined reference to `Sophus::SE3::operator=(Sophus::SE3 const&)'
/usr/bin/ld: /home/zf/ROS_PROJECT2/devel/lib/libvikit_common.so: undefined reference to `Sophus::SE3::SE3()'
/usr/bin/ld: /home/zf/ROS_PROJECT2/devel/lib/libvikit_common.so: undefined reference to `Sophus::SE3::SE3(Sophus::SE3 const&)'

解决办法是硬性将cmake链接到/usr/local/lib/libSophus.so上:

find_package(sophus REQUIRED)
set(Sophus_LIBRARIES libSophus.so)
include_directories( ${Sophus_INCLUDE_DIRS} )
target_link_libraries(${PROJECT_NAME} ${Sophus_LIBRARIES})

参考链接:编译报错undefined reference to `Sophus::SE3::operator*(Eigen::Matrix<double, 3, 1, 0, 3, 1> const&) 解决方法_undefined reference to `sophus::so3::so3(eigen::ma_wongHome的博客-CSDN博客

  • 0
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值