Hello ROS developers! In this post, you’ll learn how to create a ROS2 workspace in four easy steps 🙂 . Let’s go!
COMMANDS TO USE
mkdir -p my_ros2_ws/src
The Four Easy Steps to Creating a ROS2 Workspace
Let’s jump straight in. Here I’m giving the four steps “upfront”; practical demonstrations follow.
I will use ROSDS for this example, which allows me to create a ROSject which already has ROS2 Crystal installed on it . Heck, no time to go through the installation now. Unless you have > 24 hours per day, you can try ROSDS too 🙂
|2||Create workspace directory
~$ mkdir -p ros2_ws/src && cd ros2_ws
|3||Build workspace with
~/ros2_ws$ colcon build
|4||Source workspace setup files
~/ros2_ws$ source install/local_setup.bash && source install/setup.bash
Already got the idea? Great, rush off to your terminal and get the job done! The rest of us will proceed to the practicals.
Practicals: Executing the Four Easy Steps to Creating a ROS2 Workspace
Easier said than done, right? No, for this case, it’s easier done than said. Take a look:
Either of the following will do:
- Use the ROS Development Studio (ROSDS), an online platform for developing for ROS within a PC browser. Easy-peasy. I’m using this option of this post. To open a “terminal” on ROSDS, pick the
Shellapp from the Tools menu.
- You have ROS2 installed on a local PC. Okay, skip to step 2.
Straight to the point:
root@086ad5448257:/# cd ~ root@086ad5448257:~# mkdir -p ros2_ws/src && cd ros2_ws root@086ad5448257:~/ros2_ws#
Now for the real deal…build the workspace:
root@086ad5448257:~/ros2_ws# colcon build Summary: 0 packages finished [0.13s] root@086ad5448257:~/ros2_ws# ll total 24 drwxr-xr-x 6 root root 4096 Feb 20 20:19 ./ drwx------ 6 root root 4096 Feb 20 20:17 ../ drwxr-xr-x 2 root root 4096 Feb 20 20:19 build/ drwxr-xr-x 2 root root 4096 Feb 20 20:19 install/ drwxr-xr-x 3 root root 4096 Feb 20 20:19 log/ drwxr-xr-x 2 root root 4096 Feb 20 20:17 src/ root@086ad5448257:~/ros2_ws#
Source the workspace, and you’re done:
root@086ad5448257:~/ros2_ws# source install/local_setup.bash && so urce install/setup.bash root@086ad5448257:~/ros2_ws#
Did you like this post? Please leave a comment in the comments section below, so we can interact and learn from each other.
If you want to learn about other ROS topics, please let us know on the comments area and we will look into doing a post and/or video about it.
Thank you for reading and/or watching!