ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
2

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

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

itfanr gravatar image
itfanr@itfanr-pc:ros2_ws$ cd /opt/ros/bouncy
itfanr@itfanr-pc:bouncy$ ls
bin            lib               _local_setup_util.py  setup.ps1  src
cmake          local_setup.bash  local_setup.zsh       setup.sh
COLCON_IGNORE  local_setup.ps1   opt                   setup.zsh
include        local_setup.sh    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
2

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

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

Question Tools

4 followers

Stats

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

Seen: 1,402 times

Last updated: Nov 15 '18