Easily Switch Between ROS1 and ROS2 Terminal Environments

Hi There! This is perhaps a few years late, but I wanted to share this with anyone who may find it useful. I documented a little command-line tool I created a while ago for quickly switching between ROS1 and ROS2 in the terminal:

As someone who occasionally has to run/maintain both ROS1 and ROS2 packages, it’s been a huge help.

Here’s how it works:

Open a new terminal, notice that it shows:

ROS 1 Environment Sourced

If you want to switch to ROS2 simply type:

rs 2

And now it says

ROS 2 Environment Sourced

That’s it! no concerns about mixed up environment variables.