This refers to the directory you put all the files you will be working on when using ROS.

Nomenclature: all workspaces for ROS have just stuck to a standard - <name>_ws


NOTE: this step should’ve already been done if you installed ROS and did everything as mentioned in the documentation.

First, you want to make sure your terminal knows that ROS exists and it can use ROS commands. You will have to source the ROS environment with:

source /opt/ros/<DISTRO>/setup.bash

in our case of using jazzy,

source /opt/ros/jazzy/setup.bash

You have to make sure you do this everytime you want to use ROS, so you can just put the command in your ~/.bashrc

gedit ~/.bashrc
# add the source command to the end of the file
# save it and close it
# if gedit is not found, use the code editor and open .bashrc
# (may have to show hidden files)

The .bashrc in your home directory always gets executed when you open a new terminal.


If you’re using ConstructSim, running ls on the home (~) directory should show you some workspaces that have already been made for you. catkin_ws , ros2_ws are the most common names for workspaces.

If you are making a workspace for the first time, you would use the same command you would to make a directory: mkdir my_ws. Every workspace should always consist of a src directory to start off with, else ROS cannot build that workspace. So then you would cd into your workspace and create a src directory, so in short, all of this can be combined to:

mkdir -p my_ws/src

Now you want to change directory to your workspace and then build it

cd my_ws
colcon build