waunvol / car_navigation

基础dijsktra和A*的路径规划与导航
40 stars 9 forks source link

ctrl_node.cpp在18.04下编译出现错误 #2

Open MA-xiaowen opened 1 year ago

MA-xiaowen commented 1 year ago

/home/mr/workspace/Pathplanner/src/car_navigation/navigation/car_motion_ctrl/src/ctrl_node.cpp:17:38: error: ‘path_lock’ was not declared in this scope std::lock_guard lock(path_lock); ^~~~~ /home/mr/workspace/Pathplanner/src/car_navigation/navigation/car_motion_ctrl/src/ctrl_node.cpp:17:38: note: suggested alternative: ‘pathconf’ std::lock_guard lock(path_lock); ^~~~~ pathconf /home/mr/workspace/Pathplanner/src/car_navigation/navigation/car_motion_ctrl/src/ctrl_node.cpp:17:33: error: ‘lock’ was not declared in this scope std::lock_guard lock(path_lock); ^~~~ /home/mr/workspace/Pathplanner/src/car_navigation/navigation/car_motion_ctrl/src/ctrl_node.cpp:17:33: note: suggested alternative: In file included from /usr/include/boost/thread/locks.hpp:10:0, from /usr/include/boost/thread.hpp:21, from /opt/ros/melodic/include/costmap_2d/costmap_2d.h:44, from /opt/ros/melodic/include/costmap_2d/layer.h:40, from /opt/ros/melodic/include/costmap_2d/layered_costmap.h:42, from /opt/ros/melodic/include/costmap_2d/costmap_2d_ros.h:41, from /home/mr/workspace/Pathplanner/src/car_navigation/navigation/car_motion_ctrl/include/local_planner/simple_dwa_planner.h:12, from /home/mr/workspace/Pathplanner/src/car_navigation/navigation/car_motion_ctrl/src/ctrl_node.cpp:4: /usr/include/boost/thread/lock_algorithms.hpp:253:8: note: ‘boost::lock’ void lock(MutexType1& m1, MutexType2& m2, MutexType3& m3, MutexType4& m4, MutexType5& m5) ^~~~ /home/mr/workspace/Pathplanner/src/car_navigation/navigation/car_motion_ctrl/src/ctrl_node.cpp: In function ‘int main(int, char)’: /home/mr/workspace/Pathplanner/src/car_navigation/navigation/car_motion_ctrl/src/ctrl_node.cpp:100:17: error: ‘path_lock’ was not declared in this scope path_lock.lock(); ^~~~~ /home/mr/workspace/Pathplanner/src/car_navigation/navigation/car_motion_ctrl/src/ctrl_node.cpp:100:17: note: suggested alternative: ‘path_sub’ path_lock.lock(); ^~~~~ path_sub /home/mr/workspace/Pathplanner/src/car_navigation/navigation/car_motion_ctrl/src/ctrl_node.cpp:106:17: error: ‘path_lock’ was not declared in this scope path_lock.lock(); ^~~~~ /home/mr/workspace/Pathplanner/src/car_navigation/navigation/car_motion_ctrl/src/ctrl_node.cpp:106:17: note: suggested alternative: ‘path_sub’ path_lock.lock(); ^~~~~ path_sub car_navigation/navigation/car_motion_ctrl/CMakeFiles/ctrlNode.dir/build.make:75: recipe for target 'car_navigation/navigation/car_motion_ctrl/CMakeFiles/ctrlNode.dir/src/ctrl_node.cpp.o' failed make[2]: ** [car_navigation/navigation/car_motion_ctrl/CMakeFiles/ctrlNode.dir/src/ctrl_node.cpp.o] Error 1 CMakeFiles/Makefile2:2470: recipe for target 'car_navigation/navigation/car_motion_ctrl/CMakeFiles/ctrlNode.dir/all' failed make[1]: [car_navigation/navigation/car_motion_ctrl/CMakeFiles/ctrlNode.dir/all] Error 2 Makefile:145: recipe for target 'all' failed make: *** [all] Error 2 Invoking "make -j36 -l36" failed

MA-xiaowen commented 1 year ago

我是这样解决的: 添加这三个头文件,编译通过,作者如果有更好的方法希望分享。

include

include

include

waunvol commented 1 year ago
  1. 可能是18.04的问题?这个我也不清楚,我这里20.04两个台电脑都是无修改一次编过的;
  2. 看报错,是少了个 #include <mutex> ??? 我好像确实没加,建议你可以单加这个试一试。