- 问题: navigation自定义global planner, 运行.launch文件时报错: Could not load library (libnav2_smac_planner.so, undefined symbol: _ZTVN4ompl4base16DubinsStateSpaceE); 无法调用规划器
- 首先找动态链接库文件, 保证已经生成了.so文件, 路径是your_catkin_workspace/devel/lib
- 终端运行
ldd ~/navigation/devel/lib//libnav2_smac_planner.so , 保证动态链接库的依赖都能找到, 运行后会出现一系列 xxx.so => xxx.so 没有missing 或 no found 应该就没问题(没遇到所以不知道遇到的解决方案) - undefined symbol:
cd your_catkin_workspace/devel/lib , 运行 nm -u libnav2_smac_planner.so | grep _ZTVN4ompl4base16DubinsStateSpaceE 可以得到U _ZTVN4ompl4base16DubinsStateSpaceE 说明这个东西没定义 - 运行
c++filt _ZTVN4ompl4base16DubinsStateSpaceE shows 恢复成c++编译前的样子, 得vtable for ompl::base::DubinsStateSpace shows 说明ompl::base::DubinsStateSpace没定义, 结果发现是CMakeLists.txt 中没有添加OMPL, 所以添加以下代码
find_package(OMPL REQUIRED)
if(NOT OMPL_FOUND)
message(AUTHOR_WARNING,"Open Motion Planning Library not found")
endif(NOT OMPL_FOUND)
include_directories(
include
${catkin_INCLUDE_DIRS}
${OMPL_INCLUDE_DIRS}
}
target_link_libraries(nav2_smac_planner
${catkin_LIBRARIES}
${OMPL_LIBRARIES}
)
就可以了.(虽然还有好多其他报错, 一个个查吧)
|