Ask Your Question

what is difference between local_setup.bash and setup.bash in ros2

asked 2018-11-06 18:42:48 -0500

itfanr gravatar image
itfanr@itfanr-pc:ros2_ws$ cd /opt/ros/bouncy
itfanr@itfanr-pc:bouncy$ ls
bin            lib       setup.ps1  src
cmake          local_setup.bash  local_setup.zsh
COLCON_IGNORE  local_setup.ps1   opt                   setup.zsh
include    setup.bash            share

My ros2 directory is listed above. what is difference between local_setup.bash and setup.bash in ros2 ? Thank you.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-11-15 16:16:59 -0500

alsora gravatar image

After you build a ROS2 workspace, you have to add some directories to your path in order to being able to run the nodes or to build other packages which depend on something in the just built workspace.

Both scripts can be used to setup the environment, but their effect is slightly different.

  • local_setup.* will add to the path only the directories built in the current workspace
  • setup.* will add to the path the directories built in the current workspace AND the directories of the packages that were sourced while building the current workspace. This last operation will be done by sourcing the local_setup.* files for those workspaces.

Some examples:

  • If you want to source the ROS2 SDK, the two scripts will have the same effect as there are no workspaces which are on top of the current one.

  • I create a workspace for my new package. In order to build it I have to source the ROS2 SDK. When I will run something from this package I will have two options for setting up the environment: I can source setup.* OR I can source /opt/ros2/bouncy/setup.* and source local_setup.*

You can find some information here

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2018-11-06 18:42:48 -0500

Seen: 556 times

Last updated: Nov 15 '18