ros2 building/sourcing workspace question

asked 2023-02-19 01:58:16 -0500

In the creating a workspace tutorial for ROS2 the when it comes to sourcing the workspace the advice is

Before sourcing the overlay, it is very important that you open a new terminal, separate from the one where you built the workspace. Sourcing an overlay in the same terminal where you built, or likewise building where an overlay is sourced, may create complex issues.

I am not aware of this having been an issue in ROS1, and for ROS1the common practise was to add the sourcing command to .bashrc for a workspace you were regularly using so you didn't need to remember to source it.

Is there any further documentation of what these complex issues could be that I could read as I will be teaching so it would be useful to have an idea of what kind of problems might be caused if a student has done this, and what steps would be necessary to fix it.

Is there a recommended/better way of making a workspace available by default in a terminal that is easy to override for a single terminal to build the workspace, or is it a case of remembering to source a workspace in appropriate terminals while actively working in a workspace, only adding it to the .bashrc file once you have finished developing in the workspace.

edit retag flag offensive close merge delete


check point2 of configuration environment -

AbhishekMitra gravatar image AbhishekMitra  ( 2023-02-19 02:41:43 -0500 )edit

I understand using it for the main ros install - I am wondering about when using a workspace overlay is there a more elegant way to manage what seems to be a new requirement in ros2 - that you should run the build command in a terminal where the workspace is not sourced (and so adding it to the .bashrc file is not a good way to go as you would need to edit the .bashrc to get a terminal for,building in) and the alternative irritation if you don't add it to the .bashr filecof having to remember to source the workspace in each terminal manually that you want the workspace to be used as a source for packages that will be run.

Both seem to rely on a irritating/easy to get wrong manual process - and then keeping track of which terminals have sourced the workspace and which haven ...(more)

nickw gravatar image nickw  ( 2023-02-19 10:33:03 -0500 )edit