SLAM学习:Eigen几何模块测试

这篇博客主要介绍了SLAM学习中Eigen库的几何模块,包括旋转矩阵、旋转向量、欧拉角、四元数、欧氏变换矩阵、仿射变换和射影变换等数据结构的使用。博客提到了所有数据结构都有单精度和双精度两种类型,并提供了双精度数据类型的示例。测试示例的结果并未在摘要中给出。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

数据结构:

旋转矩阵(3 × 3):Eigen::Matrix3d

旋转向量(3 × 1):Eigen::AngleAxisd

欧拉角

guo@guo-Dell-G15-5520:~/g2o仿真/src/build$ make Consolidate compiler generated dependencies of target g2o_demo [ 50%] Building CXX object CMakeFiles/g2o_demo.dir/optimize.cc.o /home/guo/g2o仿真/src/optimize.cc: In function ‘std::vector<Eigen::Transform<double, 3, 1> > generateNoisyTrajectory(int)’: /home/guo/g2o仿真/src/optimize.cc:73:44: error: expected primary-expression before ‘(’ token 73 | Quaterniond noise_rot = Quaterniond(AngleAxisd( | ^ /home/guo/g2o仿真/src/optimize.cc:75:32: error: expected ‘)’ before ‘;’ token 75 | Vector3d::UnitZ())); | ^ | ) /home/guo/g2o仿真/src/optimize.cc:73:44: note: to match this ‘(’ 73 | Quaterniond noise_rot = Quaterniond(AngleAxisd( | ^ /home/guo/g2o仿真/src/optimize.cc: In function ‘int main()’: /home/guo/g2o仿真/src/optimize.cc:162:9: error: ‘Matrix6d’ was not declared in this scope 162 | Matrix6d info = Matrix6d::Identity(); | ^~~~~~~~ /home/guo/g2o仿真/src/optimize.cc:163:30: error: ‘info’ was not declared in this scope 163 | edge->setInformation(info); | ^~~~ /home/guo/g2o仿真/src/optimize.cc:178:5: error: ‘Matrix6d’ was not declared in this scope 178 | Matrix6d loopInfo = Matrix6d::Identity() * 10.0; | ^~~~~~~~ /home/guo/g2o仿真/src/optimize.cc:179:30: error: ‘loopInfo’ was not declared in this scope 179 | loopEdge->setInformation(loopInfo); | ^~~~~~~~ In file included from /usr/local/include/eigen3/Eigen/Geometry:42, from /home/guo/g2o仿真/src/optimize.cc:4: /usr/local/include/eigen3/Eigen/src/Geometry/Quaternion.h: In instantiation of ‘Derived& Eigen::QuaternionBase<Derived>::operator=(const Eigen::MatrixBase<OtherDerived>&) [with OtherDerived = Eigen::CwiseBinaryOp<Eigen::internal::scalar_product_op<double, double>, const Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, const Eigen::Matrix<double, 3, 1> >, const Eigen::Block<const Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<double>, Eigen::Matrix<double, 3, 3> >, 3, 1, false> >; Derived = Eigen::Quaternion<double>]’: /usr/local/include/eigen3/Eigen/src/Geometry/Quaternion.h:313:90: required from ‘Eigen::Quaternion<Scalar, Options>::Quaternion(const Eigen::MatrixBase<OtherDerived>&) [with Derived = Eigen::CwiseBinaryOp<Eigen::internal::scalar_product_op<double, double>, const Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, const Eigen::Matrix<double, 3, 1> >, const Eigen::Block<const Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<double>, Eigen::Matrix<double, 3, 3> >, 3, 1, false> >; _Scalar = double; int _Options = 0]’ /usr/local/include/eigen3/Eigen/src/Geometry/AngleAxis.h:201:18: required from ‘Eigen::AngleAxis<_Scalar>& Eigen::AngleAxis<Scalar>::operator=(const Eigen::MatrixBase<OtherDerived>&) [with Derived = Eigen::CwiseBinaryOp<Eigen::internal::scalar_product_op<double, double>, const Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, const Eigen::Matrix<double, 3, 1> >, const Eigen::Block<const Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<double>, Eigen::Matrix<double, 3, 3> >, 3, 1, false> >; _Scalar = double]’ /usr/local/include/eigen3/Eigen/src/Geometry/AngleAxis.h:88:85: required from ‘Eigen::AngleAxis<Scalar>::AngleAxis(const Eigen::MatrixBase<OtherDerived>&) [with Derived = Eigen::CwiseBinaryOp<Eigen::internal::scalar_product_op<double, double>, const Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, const Eigen::Matrix<double, 3, 1> >, const Eigen::Block<const Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<double>, Eigen::Matrix<double, 3, 3> >, 3, 1, false> >; _Scalar = double]’ /home/guo/g2o仿真/src/optimize.cc:75:31: required from here /usr/local/include/eigen3/Eigen/src/Geometry/Quaternion.h:583:59: error: incomplete type ‘Eigen::internal::quaternionbase_assign_impl<Eigen::CwiseBinaryOp<Eigen::internal::scalar_product_op<double, double>, const Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, const Eigen::Matrix<double, 3, 1> >, const Eigen::Block<const Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<double>, Eigen::Matrix<double, 3, 3> >, 3, 1, false> >, 3, 1>’ used in nested name specifier 583 | internal::quaternionbase_assign_impl<MatrixDerived>::run(*this, xpr.derived()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ make[2]: *** [CMakeFiles/g2o_demo.dir/build.make:76:CMakeFiles/g2o_demo.dir/optimize.cc.o] 错误 1 make[1]: *** [CMakeFiles/Makefile2:673:CMakeFiles/g2o_demo.dir/all] 错误 2 make: *** [Makefile:146:all] 错误 2 guo@guo-Dell-G15-5520:~/g2o仿真/src/build$
最新发布
08-03
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

JoannaJuanCV

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值