Nav2导航框架
-
动手学Ros2,第11章 4.2源码安装navigation2
colcon build --packages-up-to navigation2 编译之后出现如下错误
/home/li/work/WorkSpace/fishbot_ws/src/navigation2/nav2_mppi_controller/test/noise_generator_test.cpp: In member function ‘virtual void NoiseGeneratorTest_NoiseGeneratorLifecycle_Test::TestBody()’: /home/li/work/WorkSpace/fishbot_ws/src/navigation2/nav2_mppi_controller/test/noise_generator_test.cpp:45:32: error: ‘rclcpp_lifecycle’ was not declared in this scope 45 | auto node = std::make_shared<rclcpp_lifecycle::LifecycleNode>("node"); | ^~~~~~~~~~~~~~~~ /home/li/work/WorkSpace/fishbot_ws/src/navigation2/nav2_mppi_controller/test/noise_generator_test.cpp:45:20: error: parse error in template argument list 45 | auto node = std::make_shared<rclcpp_lifecycle::LifecycleNode>("node"); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/li/work/WorkSpace/fishbot_ws/src/navigation2/nav2_mppi_controller/test/noise_generator_test.cpp:45:64: error: no matching function for call to ‘make_shared<<expression error> >(const char [5])’ 45 | auto node = std::make_shared<rclcpp_lifecycle::LifecycleNode>("node"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~ In file included from /usr/include/c++/11/memory:77, from /opt/ros/humble/src/gtest_vendor/include/gtest/gtest.h:57, from /home/li/work/WorkSpace/fishbot_ws/src/navigation2/nav2_mppi_controller/test/noise_generator_test.cpp:18: /usr/include/c++/11/bits/shared_ptr.h:875:5: note: candidate: ‘template<class _Tp, class ... _Args> std::shared_ptr<_Tp> std::make_shared(_Args&& ...)’ 875 | make_shared(_Args&&... __args) | ^~~~~~~~~~~ /usr/include/c++/11/bits/shared_ptr.h:875:5: note: template argument deduction/substitution failed: /home/li/work/WorkSpace/fishbot_ws/src/navigation2/nav2_mppi_controller/test/noise_generator_test.cpp:45:64: error: template argument 1 is invalid 45 | auto node = std::make_shared<rclcpp_lifecycle::LifecycleNode>("node"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~ /home/li/work/WorkSpace/fishbot_ws/src/navigation2/nav2_mppi_controller/test/noise_generator_test.cpp:47:3: error: ‘ParametersHandler’ was not declared in this scope 47 | ParametersHandler handler(node); | ^~~~~~~~~~~~~~~~~ /home/li/work/WorkSpace/fishbot_ws/src/navigation2/nav2_mppi_controller/test/noise_generator_test.cpp:49:55: error: ‘handler’ was not declared in this scope 49 | generator.initialize(settings, false, "test_name", &handler); | ^~~~~~~ /home/li/work/WorkSpace/fishbot_ws/src/navigation2/nav2_mppi_controller/test/noise_generator_test.cpp: In member function ‘virtual void NoiseGeneratorTest_NoiseGeneratorMain_Test::TestBody()’: /home/li/work/WorkSpace/fishbot_ws/src/navigation2/nav2_mppi_controller/test/noise_generator_test.cpp:57:32: error: ‘rclcpp_lifecycle’ was not declared in this scope 57 | auto node = std::make_shared<rclcpp_lifecycle::LifecycleNode>("node"); | ^~~~~~~~~~~~~~~~ /home/li/work/WorkSpace/fishbot_ws/src/navigation2/nav2_mppi_controller/test/noise_generator_test.cpp:57:20: error: parse error in template argument list 57 | auto node = std::make_shared<rclcpp_lifecycle::LifecycleNode>("node"); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/li/work/WorkSpace/fishbot_ws/src/navigation2/nav2_mppi_controller/test/noise_generator_test.cpp:57:64: error: no matching function for call to ‘make_shared<<expression error> >(const char [5])’ 57 | auto node = std::make_shared<rclcpp_lifecycle::LifecycleNode>("node"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~ In file included from /usr/include/c++/11/memory:77, from /opt/ros/humble/src/gtest_vendor/include/gtest/gtest.h:57, from /home/li/work/WorkSpace/fishbot_ws/src/navigation2/nav2_mppi_controller/test/noise_generator_test.cpp:18: /usr/include/c++/11/bits/shared_ptr.h:875:5: note: candidate: ‘template<class _Tp, class ... _Args> std::shared_ptr<_Tp> std::make_shared(_Args&& ...)’ 875 | make_shared(_Args&&... __args) | ^~~~~~~~~~~ /usr/include/c++/11/bits/shared_ptr.h:875:5: note: template argument deduction/substitution failed: /home/li/work/WorkSpace/fishbot_ws/src/navigation2/nav2_mppi_controller/test/noise_generator_test.cpp:57:64: error: template argument 1 is invalid 57 | auto node = std::make_shared<rclcpp_lifecycle::LifecycleNode>("node"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~ /home/li/work/WorkSpace/fishbot_ws/src/navigation2/nav2_mppi_controller/test/noise_generator_test.cpp:59:3: error: ‘ParametersHandler’ was not declared in this scope 59 | ParametersHandler handler(node); | ^~~~~~~~~~~~~~~~~ /home/li/work/WorkSpace/fishbot_ws/src/navigation2/nav2_mppi_controller/test/noise_generator_test.cpp:81:55: error: ‘handler’ was not declared in this scope 81 | generator.initialize(settings, false, "test_name", &handler); | ^~~~~~~ gmake[2]: *** [test/CMakeFiles/noise_generator_test.dir/build.make:76:test/CMakeFiles/noise_generator_test.dir/noise_generator_test.cpp.o] 错误 1 gmake[1]: *** [CMakeFiles/Makefile2:334:test/CMakeFiles/noise_generator_test.dir/all] 错误 2 gmake: *** [Makefile:146:all] 错误 2 --- Failed <<< nav2_mppi_controller [2.76s, exited with code 2]
请教解决方案
-
@2307205467 嘿嘿,跟我的错误一样,看我发的帖子,小鱼回复是让二进制安装。
-
@1367426346 这样操作
git clone https://github.com/ros-planning/navigation2.git -b humble
git reset 1.1.9回退下版本后测试
-
@小鱼 回退有错误:
fatal: 有歧义的参数 '1.1.9':未知的版本或路径不存在于工作区中。 使用 '--' 来分隔版本和路径,例如: 'git <命令> [<版本>...] -- [<文件>...]'
-
git clone https://github.com/ros-planning/navigation2.git -b humble
cd navigation2 # 加上这句
git reset 1.1.9 -
@小鱼 回退成了,但是编译还是报原来的错误…