i created a workspace and cloned the ros-planning/navigation2 github into my workspace. (I also have the nav2 in my underlay /opt/ros/foxy/share) Next i created a python launch file to run the navigation stack and other stuff. However, the python launch file always access my underlay nav2_params.yaml file in /opt/ros/foxy/share instead of my nav2_params.yaml in my workspace. I renamed the folder in my workspace from nav2_bringup (in /opt/ros/foxy) to robot_nav2_bringup (my src workspace)
The code you show looks correct, so I don’t think the error comes from it. However, there could be many different reasons why this could happen.
Are you correctly sourcing your workspace so that it can be detected by the ROS2 system?
Have you correctly renamed the package? Or did you just rename the folder name?
And many others
Because you are in your local environment, it’s very hard for us to be more precise on this. My suggestion would be to remove the nav2 packages you have in /opt/ros... and leave only the packages in your workspace. This will allow you to better debug what’s going on.
first thank you so much for you answer. I really appreciate you help
I can’t delete the underlay /opt/ros because i still need this.
I sourcing both the underlay /opt/ros and my workspace: alias foxy2="source ~/robot_ws/install/setup.bash && source /opt/ros/foxy/setup.bash && source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash; echo 'Foxy2 is Active'"
I’m confused because i named the folder robot_nav2_bringup of ros-planning/navigation2 in my src workspace but it still access the /opt/ros/foxy/share. It access the nav2_bringup folder in /opt/ros with the nav2_params.yaml file.