A command-line tool for managing ROS 2 colcon workspaces. It lets you create, register, and switch between multiple workspaces with ease.
Table of Contents
Install from PyPI using pip:
pip install ros-wsIf you like to both use and hack ros-ws, you can install the software by pointing the installation to the development code.
Clone the repository:
git clone https://github.com/Rayman/ros-ws.git
Install using
pipwith the editable option-e DIR.cd ros-ws pip install --user -e .
The final
.says thatpipshould redirect thewscommand relative to this directory (to./src/ros-ws).
- Python >= 3.10
- colcon-common-extensions
- ROS 2 (e.g. jazzy, Iron, Jazzy) installed on the system
To automatically source the active workspace in every new shell, add the
following snippet to your ~/.bashrc:
source "$(ws locate)/install/setup.bash"ws [-h] [-v] [--version] {create,switch,save,list,locate,name} ...
Create a new colcon workspace that extends an existing ROS result-space.
The workspace is built with colcon build and then registered automatically.
ws create [-h] [--dir DIR] [--name NAME] extendExample:
mkdir ~/ros2_workspace && cd ~/ros2_workspace
ws create /opt/ros/jazzySwitch the active workspace to a previously registered one.
ws switch [-h] nameExample:
ws switch ros2_workspaceRegister an existing workspace directory without building it. Useful for
importing a workspace that was created outside of ws.
If no workspace is currently active, the saved workspace also becomes the
active one.
ws save [-h] [--name NAME] dirExample:
ws save ~/ros2_workspaceList all registered workspaces. The currently active workspace is marked
with (active). Workspaces whose directory no longer exists are
highlighted in red.
ws list [-h]Example output:
- jazzy => /home/user/ws_jazzy (active)
- iron => /home/user/ws_iron
Print the absolute path of the active workspace. Returns exit code 1 if
no workspace is currently active. Useful in scripts:
ws locate [-h]Example:
cd "$(ws locate)"Print the name of the active workspace. Returns exit code 1 if no
workspace is currently active.
ws name [-h]Example:
echo "Current workspace: $(ws name)"Workspace registrations are stored as symlinks under the
XDG_CONFIG_HOME
directory (defaults to ~/.config):
~/.config/ros-ws/
├── workspace # symlink → workspaces/<active-name>
└── workspaces/
├── jazzy # symlink → /home/user/ws_jazzy
└── iron # symlink → /home/user/ws_iron
MIT — see LICENSE for details.