How to Create a ROS 2 Workspace – Iron

In this tutorial, we will go over how to create a ROS 2 workspace.

In ROS 2, a workspace serves as the central point for organizing and developing your robot software. It’s a directory that houses all the different software packages, data files, and configuration scripts related to your specific robot project. Think of it as a dedicated folder for all your “robot building blocks.”

The official instructions for creating a workspace are here, but I will walk you through the entire process, step by step.

Let’s get started!

Prerequisites

Directions

Open a terminal, and type these commands:

mkdir -p ~/ros2_ws/src
cd ~/ros2_ws/
colcon build
echo "source ~/ros2_ws/install/setup.bash" >> ~/.bashrc

That’s it! You have now created a ROS 2 workspace.

How to Install and Configure Visual Studio Code for ROS 2

In this tutorial, we will go over how to install and configure Visual Studio Code for your ROS 2 projects.

Visual Studio Code, often shortened to VS Code, is a free and open-source code editor developed by Microsoft. It’s a popular choice for programmers of all levels, from beginners to professionals, because it’s:

  • Lightweight and fast: It doesn’t take up much space on your computer and starts up quickly, so you can get coding right away.
  • Versatile: It supports a wide range of programming languages, including JavaScript, Python, Java, C++, and more. You can also install extensions to add support for even more languages.
  • Customizable: You can personalize VS Code with themes, extensions, and keyboard shortcuts to make it work the way you want.
  • Feature-rich: It comes with built-in features like syntax highlighting, code completion, and debugging, which can help you write better code faster.

Let’s get started!

Prerequisites

Directions

Go to this page.

Click the .deb button.

Open a terminal window, and type:

cd ~/Downloads

Run the following command, replacing “filename.deb” with the actual name of your file:

sudo dpkg -i filename.deb

Enter your password when prompted.

The installation will start. Wait for it to complete.

Open VS Code by typing this command in a terminal window:

code
4-open-vs-code

Double-click on the Extensions button on the bottom left side of the window.

5-extensions-tab

Search for the “C/C++” extension.

6-cpp-extension

Install it.

Search for the “ROS” extension.

7-ros-extension-microsoft

Install the ROS extension from Microsoft by clicking the Install button. 

We haven’t created a ROS 2 workspace, but when we do, we will open VS Code as follows:

cd ~/ros2_ws/src
code .

Now let’s install the CMake extension. Search for “CMake”, and install the version made by twxs.

Install the CMake Tools extensions. Search for “CMake Tools”, and install the version made by Microsoft.

Install the XML extensions. Search for “XML”, and install the version made by Red Hat.

Now let’s install the Python extension. Search for “python”, and install the version made by Microsoft. Note: You may have already installed it. 

Install the autoDocstring extension. Search for “autoDocstring”, and install the version made by Nils Werner.

That’s it! 

Now you can close VS Code by going to File -> Exit.

How Generative AI Will Impact Robotics

Generative AI is expected to have a major impact on the field of robotics, transforming the way robots are designed, developed, and deployed.

What is Generative AI?

Generative AI works by learning from a lot of examples. For example, if you want a generative AI to create pictures of cats, you would show it a lot of pictures of cats. The generative AI would then learn what cats look like and how to draw them.

Once the generative AI has learned from a lot of examples, it can start to create new things.

For example, it could draw a picture of a cat that you’ve never seen before. Or it could write a story about a cat who goes on an adventure.

1-group-of-cats

Generative AI is still under development, but it’s already being used to create all sorts of amazing things. For example, it’s being used to create new drugs and medical treatments, to design new products, and to create new forms of art and entertainment.

How Generative AI Will Impact Robotics

Here are some specific ways in which generative AI is likely to change robotics:

Robot Design

2-robot-design-hand-prosthesis

Generative AI can be used to design new and innovative robots, optimized for specific tasks and environments. For example, generative AI can be used to design robots with lightweight, energy-efficient bodies, or robots that can move and manipulate objects in complex and unstructured environments.

Robot Control

3-robot-control-mobile-unstructured

Generative AI can be used to develop new control algorithms for robots, enabling them to learn new behaviors and adapt to changing conditions more effectively. For example, generative AI can be used to develop robots that can learn to perform new tasks by watching humans, or robots that can plan and navigate their way through unknown environments.

Robot Training

4-robot-training

Generative AI can be used to create realistic simulations of real-world environments, which can be used to train robots before they are deployed in the real world. This can help reduce the risk of damage to robots and their surroundings, and can also help robots learn faster and more efficiently.

Human-Robot Interaction

5-human-robot-interaction

Generative AI can be used to develop robots that can interact with humans more naturally and effectively. For example, generative AI can be used to develop robots that can understand and respond to human language, or robots that can generate realistic facial expressions and body language.

Examples of Generative AI in Industry Today

6-examples-of-generative-ai

Here are some specific examples of how generative AI is already being used in robotics today:

These are just a few examples of the many ways in which generative AI is being used to revolutionize the field of robotics. As generative AI technology continues to develop, we can expect to see even more innovative and exciting applications for robots in the years to come.

Keep building!