ubuntu20.04 ad_with_lanelet2 编译问题解决

参考链接

https://blog.youkuaiyun.com/qq_35632833/article/details/112923613

相关依赖

sudo apt-get install ros-noetic-uuid-msgs 
sudo apt-get install ros-noetic-tf2-geometry-msgs 
sudo apt-get install ros-noetic-unique-id

还会提示缺少 mrt_cmake_modules,下载链接:mrt_cmake_modules

下载完后放到 common

编译问题

In file included from /usr/include/boost/config.hpp:61:0,
                 from /usr/include/boost/math/tools/config.hpp:13,
                 from /usr/include/boost/math/special_functions/round.hpp:13,
                 from /opt/ros/kinetic/include/ros/time.h:58,
                 from /opt/ros/kinetic/include/ros/ros.h:38,
                 from /home/seivl/hd_ws/src/ad_with_lanelet2/planning/mission_planning/mission_planner/include/mission_planner/lanelet2_impl/mission_planner_lanelet2.h:21,
                 from /home/seivl/hd_ws/src/ad_with_lanelet2/planning/mission_planning/mission_planner/src/mission_planner_lanelet2/mission_planner_lanelet2.cpp:17:
/usr/include/boost/math/constants/constants.hpp: In static member function ‘static constexpr T boost::math::constants::detail::constant_half<T>::get(const mpl_::int_<5>&)’:
/usr/include/boost/math/constants/constants.hpp:277:3: error: unable to find numeric literal operator ‘operator""Q’
   BOOST_DEFINE_MATH_CONSTANT(half, 5.000000000000000000000000000000000000e-01, "5.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-01")
   ^
/usr/include/boost/math/constants/constants.hpp:277:3: note: use -std=gnu++11 or -fext-numeric-literals to enable more built-in suffixes
/usr/include/boost/math/constants/constants.hpp: In static member function ‘static constexpr T boost::math::constants::detail::constant_third<T>::get(const mpl_::int_<5>&)’:
/usr/include/boost/math/constants/constants.hpp:278:3: error: unable to find numeric literal operator ‘operator""Q’
   BOOST_DEFINE_MATH_CONSTANT(third, 3.333333333333333333333333333333333333e-01, "3.33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333e-01")
   ^

解决方案
修改这些路径下的CMakeLists.txt 文件:

ad_with_lanelet2/map/lanelet2_extension
ad_with_lanelet2/planning/mission_planning/mission_planner
ad_with_lanelet2/map/util/lanelet2_map_preprocessor
ad_with_lanelet2/map/map_tf_generator

加入:

add_compile_options(-std=c++14)
#add_compile_options(-std=c++11) 
#add_compile_options(-std=gnu++11)
add_compile_options(-fext-numeric-literals)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_MATH_DISABLE_FLOAT128")
/usr/bin/ld: /home/xxxxx/cleancar_ws/devel/lib/liblanelet2_extension_lib.so: undefined reference to `lanelet::routing::RoutingGraph::adjacentRight(lanelet::ConstLanelet const&, unsigned short) const'
/usr/bin/ld: /home/xxxxx/cleancar_ws/devel/lib/liblanelet2_extension_lib.so: undefined reference to `lanelet::geometry::closestSegment(lanelet::ConstLineString3d const&, Eigen::Matrix<double, 3, 1, 0, 3, 1> const&)'
/usr/bin/ld: /home/xxxxx/cleancar_ws/devel/lib/liblanelet2_extension_lib.so: undefined reference to `lanelet::routing::RoutingGraph::left(lanelet::ConstLanelet const&, unsigned short) const'
/usr/bin/ld: /home/xxxxx/cleancar_ws/devel/lib/liblanelet2_extension_lib.so: undefined reference to `lanelet::geometry::project(std::pair<Eigen::Matrix<double, 2, 1, 2, 2, 1>, Eigen::Matrix<double, 2, 1, 2, 2, 1> > const&, Eigen::Matrix<double, 2, 1, 2, 2, 1> const&)'
/usr/bin/ld: /home/xxxxx/cleancar_ws/devel/lib/liblanelet2_extension_lib.so: undefined reference to `lanelet::geometry::closestSegment(lanelet::ConstLineString2d const&, Eigen::Matrix<double, 2, 1, 2, 2, 1> const&)'
/usr/bin/ld: /home/xxxxx/cleancar_ws/devel/lib/liblanelet2_extension_lib.so: undefined reference to `lanelet::routing::RoutingGraph::besides(lanelet::ConstLanelet const&, unsigned short) const'
/usr/bin/ld: /home/xxxxx/cleancar_ws/devel/lib/liblanelet2_extension_lib.so: undefined reference to `lanelet::geometry::project(std::pair<Eigen::Matrix<double, 3, 1, 0, 3, 1>, Eigen::Matrix<double, 3, 1, 0, 3, 1> > const&, Eigen::Matrix<double, 3, 1, 0, 3, 1> const&)'
/usr/bin/ld: /home/xxxxx/cleancar_ws/devel/lib/liblanelet2_extension_lib.so: undefined reference to `lanelet::routing::RoutingGraph::right(lanelet::ConstLanelet const&, unsigned short) const'
/usr/bin/ld: /home/xxxxx/cleancar_ws/devel/lib/liblanelet2_extension_lib.so: undefined reference to `lanelet::routing::RoutingGraph::adjacentLeft(lanelet::ConstLanelet const&, unsigned short) const'
collect2: error: ld returned 1 exit status
make[2]: *** [ad_with_lanelet2/map/map_loader/CMakeFiles/lanelet2_map_visualization.dir/build.make:273: /home/xxxxx/cleancar_ws/devel/lib/map_loader/lanelet2_map_visualization] Error 1
make[1]: *** [CMakeFiles/Makefile2:13930: ad_with_lanelet2/map/map_loader/CMakeFiles/lanelet2_map_visualization.dir/all] Error 2

解决方案

sudo apt remove ros-noetic-lanelet2*
/home/xxx/cleancar_ws/src/ad_with_lanelet2/lanelet2_python/python_api/matching.cpp:33:10: fatal error: lanelet2_matching/LaneletMatching.h: No such file or directory
   33 | #include <lanelet2_matching/LaneletMatching.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [ad_with_lanelet2/lanelet2_python/CMakeFiles/lanelet2_python-lanelet2-matching-pyapi.dir/build.make:63: ad_with_lanelet2/lanelet2_python/CMakeFiles/lanelet2_python-lanelet2-matching-pyapi.dir/python_api/matching.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:4278: ad_with_lanelet2/lanelet2_python/CMakeFiles/lanelet2_python-lanelet2-matching-pyapi.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

解决方案:ad_with_lanelet2/lanelet2_python文件下的package.xml文件中添加下面一行

  <depend>lanelet2_matching</depend>
内容概要:本文详细介绍了将百度Apollo自动驾驶平台的规划模块移植到ROS(Robot Operating System)环境中的方法和步骤。主要内容涵盖环境配置、代码适配、路径转换、规划算法调整以及效果验证等方面。首先,针对环境配置部分,文中提供了详细的指令,确保Ubuntu 20.04 + ROS Noetic环境下能够顺利安装并配置所需的软件包,如Lanelet2地图框架。其次,在代码适配环节,作者深入探讨了Apollo与ROS之间的消息体系差异,尤其是坐标系转换、路径规划器接口适配等问题,并给出了具体的解决方案。此外,还涉及到了规划算法的具体调整,包括参数配置、横向规划器权重调整等。最后,对于效果验证,提出了多种调试手段,如利用RViz进行轨迹可视化、通过rqt_graph检查节点通信状态等。 适用人群:适用于有一定Linux和ROS基础,希望深入了解自动驾驶技术,特别是Apollo平台与ROS集成的技术人员。 使用场景及目标:帮助开发者克服Apollo规划模块移植到ROS过程中遇到的各种难题,最终实现一个能够在普通工控机上流畅运行的自动驾驶原型系统,支持高精度地图加载、实时避障轨迹生成等功能。 其他说明:文中不仅提供了详尽的操作指导,还包括了许多实际操作中的经验和技巧分享,如protobuf版本冲突解决、紧急制动逻辑实现、内存泄漏排查等。同时,也鼓励读者在此基础上进一步探索更多功能扩展的可能性。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值