It is possible to have both the ROS1 and ROS2 distributions installed on the same system simultaneously. To switch between them, use the CLI Terminal to source the appropriate workspace.

<aside> ⚠️ You need to source the every new terminal when you need to run the ROS1 or ROS2 command.

</aside>

Switching to ROS1 (Noetic)

  1. Press CTRL + ALT + T to open a terminal window.
  2. Run the following command to source the ROS1 distribution:
source /opt/ros/noetic/setup.bash

  1. Navigate to your catkin workspace and source it using the following command:
source devel/setup.bash

  1. To view the topics, run the following command:
rostopic list

This will display all the available topics for ROS1.

Switching to ROS2 (Humble)

  1. Press CTRL + ALT + T to open a terminal window.
  2. Run the following command to source the ROS2 distribution:
source /opt/ros/humble/setup.bash

  1. Navigate to your ROS2 workspace and source it using the following command:
source install/setup.bash

  1. To view the topics, run the following command:
ros2 topic list

This will display all the available topics for ROS2.