Robotics StackExchange | Archived questions

Ros2 setting up

Hey ROS Community,

i downloaded this repository: https://github.com/ros-planning/navigation2.git

Do you have an approach to change the planner or do you know where i can change it ? I guess there are more planner provided from the nav2 stack or do i have to create a planner by myself?

I would be grateful for any help Thank you very much in advance !

Asked by Nartmangnourt on 2023-04-16 10:21:52 UTC

Comments

Answers

Nav2 has awesome documentation with tutorials - check this "First-Time Robot Setup Guide", especially part with "Setting Up Navigation Plugins"

You can change the planners by changing plugins in the configuration YAML file.

Some other resources you can find useful:

Asked by ljaniec on 2023-04-19 06:07:11 UTC

Comments

Hey ljaniec,

first thank you for your answer. I really appreciate your help. I have another question and hope you could help me out. I looking for the smac_planner/src/smac_planner.cpp file. i downloaded the nav2 repository on github (foxy-devel). But i can't find the file : https://github.com/ros-planning/navigation2/blob/foxy-devel/smac_planner/src/smac_planner.cpp

If i using sudo apt install, the package files are installed system-wide in the /opt/ros/foxy directory, but they are compiled binaries and do not contain source files such as smac_planner.cpp.

But i still want to access the smac_planner.cpp file

Any ideas how?:)

Asked by Nartmangnourt on 2023-04-23 07:40:02 UTC

Yes, you have to set up a Nav2 workspace with the source code for packages and build & source them by yourself. Instructions are here: https://navigation.ros.org/build_instructions/index.html#for-released-distributions

"For Released Distribution" part, use foxy-devel, remember to source this workspace in the new terminal (e.g. by adding it to the ~/.bashrc) to have these packages available.

You can then check and modify this planner code to your needs.

Asked by ljaniec on 2023-04-23 08:47:06 UTC

I really appreciate your help. Thank you :)

I have another question. If i change something in the nav2 workspace, it will not change anything in the underlay /opt/ros/foxy right? The two installations are completely separate and distinct from each other?

Asked by Nartmangnourt on 2023-04-23 12:31:49 UTC

You should remove the binary install (packages installed with sudo apt-get install ...) when you are going to use the source built ones

Asked by ljaniec on 2023-04-23 13:21:38 UTC

Thank you ljaniec.

Should i remove it with : sudo apt-get --purge remove ros-foxy-navigation2 ros-foxy-nav2-bringup

And are there any disadvantages to use the source build ones?:)

Asked by Nartmangnourt on 2023-04-24 03:23:13 UTC

Yes, these commands seem OK to me. Some robotic systems have hardware limitations (memory, CPU etc if it's a standard small computer) and building everything would take too much time/is impossible - you want a binary version if possible to install on them. If you don't mind building these packages, they are even better - more fresh features from the repositories are available off-the-shelf, binaries have features only available from the last sync.

Asked by ljaniec on 2023-04-25 04:02:48 UTC

Because of your help i was able to learn a lot.

Thank you so much ;)

Asked by Nartmangnourt on 2023-04-25 06:21:05 UTC

Hey ljaniec, sorry to bother you again but after I do colcon build I get this warning:

[0.563s] WARNING:colcon.colcon_core.package_selection:Some selected packages are already built in one or more underlay workspaces:
    'nav2_map_server' is in: /home/truong/nav2_ws/install/nav2_map_server
If a package in a merged underlay workspace is overridden and it installs headers, then all packages in the overlay must sort their include directories by workspace order. Failure to do so may result in build failures or undefined behavior at run time.
If the overridden package is used by another package in any underlay, then the overriding package in the overlay must be API and ABI compatible or undefined behavior at run time may occur.

If you understand the risks and want to override a package anyways, add the following to the command line:
    --allow-overriding nav2_map_server

This may be promoted to an error in a future release of colcon-override-check.

Asked by Nartmangnourt on 2023-04-30 14:01:46 UTC

It seems you have doubled this package somewhere in your other sourced workspaces - you should find it and remove one of the copies. I would leave the one from nav2_ws if it won't break your setup - some of other packages can rely on this exact version of nav2_map_server though.

Asked by ljaniec on 2023-05-01 07:14:26 UTC