How would you separate global and local planner?
My goal is to separate the global path planner from the navigation stack. The idea is to have the regular navigation stack with local planner on the robot while calculating the global plan from a pc.
I've experimented a bit with ROS2 since it has better performance with multi robot systems. The tutorials I've tried from here do not work, however, and I'm tempted to go back to ROS1.
The problem with the tutorials is that I can't build the cloned github and I get the following error message:
Starting >>> nav2_costmap_filters_demo
Starting >>> nav2_gradient_costmap_plugin
Starting >>> nav2_sms_recovery
Starting >>> nav2_straightline_planner
Starting >>> sam_bot_description
Finished <<< nav2_costmap_filters_demo [0.28s]
Finished <<< sam_bot_description [0.26s]
--- stderr: nav2_gradient_costmap_plugin
/home/william/dev_ws/src/navigation2_tutorials/nav2_gradient_costmap_plugin/src/gradient_layer.cpp: In member function ‘virtual void nav2_gradient_costmap_plugin::GradientLayer::onInitialize()’:
/home/william/dev_ws/src/navigation2_tutorials/nav2_gradient_costmap_plugin/src/gradient_layer.cpp:70:21: error: ‘using SharedPtr = class std::shared_ptr<rclcpp_lifecycle::LifecycleNode>’ {aka ‘class std::shared_ptr<rclcpp_lifecycle::LifecycleNode>’} has no member named ‘lock’
70 | auto node = node_.lock();
| ^~~~
make[2]: *** [CMakeFiles/nav2_gradient_costmap_plugin_core.dir/build.make:63: CMakeFiles/nav2_gradient_costmap_plugin_core.dir/src/gradient_layer.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:105: CMakeFiles/nav2_gradient_costmap_plugin_core.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
---
Failed <<< nav2_gradient_costmap_plugin [2.64s, exited with code 2]
Aborted <<< nav2_straightline_planner [3.36s]
Aborted <<< nav2_sms_recovery [5.00s]
Summary: 2 packages finished [5.18s]
1 package failed: nav2_gradient_costmap_plugin
2 packages aborted: nav2_sms_recovery nav2_straightline_planner
3 packages had stderr output: nav2_gradient_costmap_plugin nav2_sms_recovery nav2_straightline_planner
After a complete removal of foxy and re-installation, I get another error:
Starting >>> nav2_costmap_filters_demo
Starting >>> nav2_gradient_costmap_plugin
Starting >>> nav2_sms_recovery
Starting >>> nav2_straightline_planner
Starting >>> sam_bot_description
Finished <<< nav2_costmap_filters_demo [1.19s]
Finished <<< sam_bot_description [1.20s]
--- stderr: nav2_gradient_costmap_plugin
CMake Error at CMakeLists.txt:26 (find_package):
By not providing "Findnav2_costmap_2d.cmake" in CMAKE_MODULE_PATH this
project has asked CMake to find a package configuration file provided by
"nav2_costmap_2d", but CMake did not find one.
Could not find a package configuration file provided by "nav2_costmap_2d"
with any of the following names:
nav2_costmap_2dConfig.cmake
nav2_costmap_2d-config.cmake
Add the installation prefix of "nav2_costmap_2d" to CMAKE_PREFIX_PATH or
set "nav2_costmap_2d_DIR" to a directory containing one of the above files.
If "nav2_costmap_2d" provides a separate development package or SDK, be
sure it has been installed.
---
Failed <<< nav2_gradient_costmap_plugin [1.69s, exited with code 1]
Aborted <<< nav2_sms_recovery [1.84s]
Aborted <<< nav2_straightline_planner [1.88s]
Summary: 2 packages finished [2.06s]
1 package failed: nav2_gradient_costmap_plugin
2 packages aborted: nav2_sms_recovery nav2_straightline_planner
3 packages had stderr output: nav2_gradient_costmap_plugin nav2_sms_recovery nav2_straightline_planner
Asked by WarTurtle on 2022-03-01 09:58:06 UTC
Answers
So did you do what you did on the ROS2 nav stack or ROS1 nav stack?
First, it is important to differentiate between a global planner and a "local" planner. This is a confusing term, it is better to refer to the former as a planner and the latter as a controller, simpler. You can write your own planner or controller as a plugin. Your controller always will need a reference trajectory so that it can follow it by producing proper twist messages.
So make sure your robot and PC are on the same network, then launch planner_server
in your PC, and the rest of the nav stack nodes on the robot, not exactly sure what did not work for you
Asked by Fetullah Atas on 2022-03-01 14:27:05 UTC
Comments
Thanks, that makes a lot of sense.
It was actually the Writing a New Planner Plugin with the goal of creating a straight line path.
The problem is that I am unable to build the packages from the github.
I tried following a tutorial by automaticaddison on the subject and tried his fix in the sms_recovery.cpp
, and when that did not work, I copied all his files into a workspace and it still did not build.
I will update you with the error message tomorrow when I have access to the pc. Cheers!
Asked by WarTurtle on 2022-03-01 16:05:55 UTC
Comments