Before you start writing code in ROS, you need to create a workspace. A workspace is a set of directories (or folders) where you store related pieces of ROS code. The official name for workspaces in ROS is catkin workspaces. The word ‘catkin’ comes from the tail-shaped flower cluster found on willow trees (see photo below) — a reference to Willow Garage, the original developers of ROS.
![willow_catkins_blossom_bloom](https://automaticaddison.com/wp-content/uploads/2019/10/willow_catkins_blossom_bloom.jpg)
All the ROS packages that you create need to reside inside a catkin workspace. The name of this catkin workspace is typically called catkin_ws.
The official instructions for creating a ROS workspace are at ROS.org, but I will walk you through the process below so you can see how it is done.
Directions
Open up a new terminal window (I’m assuming you are using ROS on Ubuntu Linux), and type the following commands to create and build at catkin workspace.
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/
catkin_make
![1-catkin-workspace](https://automaticaddison.com/wp-content/uploads/2019/10/1-catkin-workspace.jpg)
Type the dir command, and you will see three folders inside of this directory: build, devel, and src.
![2-dir-command](https://automaticaddison.com/wp-content/uploads/2019/10/2-dir-command.jpg)
Now we need to source the setup.bash file. This file sets the path of the workspace so that packages and code inside the workspace can be found.
source devel/setup.bash
![3-set-path](https://automaticaddison.com/wp-content/uploads/2019/10/3-set-path.jpg)
Make sure the workspace is properly overlayed by the setup script (which we ran above).
echo $ROS_PACKAGE_PATH
![4-make-sure](https://automaticaddison.com/wp-content/uploads/2019/10/4-make-sure.jpg)
So we don’t have to source the setup.bash file every time we open a new Linux terminal, let’s add the ~/catkin_ws/devel/setup.bash command to the .bashrc file. Open a new Linux terminal window.
Type the following command to edit the .bashrc text file:
gedit ~/.bashrc
Add this line to the end of the .bashrc file:
source ~/catkin_ws/devel/setup.bash
![5-edit-bashrc-file](https://automaticaddison.com/wp-content/uploads/2019/10/5-edit-bashrc-file.jpg)
That’s it! You’re all done. Just click Save and exit the text editor.