Ros-ws: ROS2 workspace management tool

I’m often working on multiple projects, with each project having its own ROS 2 workspace. When I’m working on a project, I want to open new terminals quickly with the setup.bash sourced. To do this, I’ve built a small tool that makes switching workspaces and automatic sourcing easier.

Quick guide:

Step 1: Create a new colcon workspace. The workspace is built with colcon build and then registered automatically.

mkdir ~/ws_name && cd ~/ws_name
ws create . /opt/ros/jazzy

Step 2: Switch the active workspace to a previously registered one.

ws switch ws_name

From this point on, if you open a new terminal, the workspace will be sourced automatically if you put the following code in your bashrc:

source "$(ws locate)/install/setup.bash"

You can find more commands and installation instructions in the README of the repository:

I know many people have created similar tools to this one, but hopefully, it will be of use to somebody. I’m using it daily.

The tool itself I’ve been using since the ROS 1 days, but recently I’ve stripped it down to its bare essentials and given it a more descriptive name.

4 Likes

If you integrate Unsource ROS 1 & 2 workspaces from environment variables · GitHub , you can even switch workspaces in a single terminal :slight_smile: (reliably!)

2 Likes

I see that it’s easier to scamble an egg than to unscramble, haha. I didn’t even think it was possible