How to Create a ROS 2 Package – Iron

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

A ROS 2 package is the fundamental building block of robot software in ROS 2. Imagine it as a Lego brick in your robot’s software architecture. Each package contains a specific piece of functionality or capability, like motor control, sensor processing, or communication with other systems.

Remember, just like Legos, you can combine multiple ROS 2 packages to create complex robot functionalities. Each package plays its specific role, and together they build the complete software system for your robot.

The official instructions for creating a package 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 (note: we are using the Apache 2.0 license, but you can remove that piece if you want):

cd ~/ros2_ws/src
ros2 pkg create --build-type ament_cmake --license Apache-2.0 cobot_arm_examples

Now let’s build our new package:

cd ~/ros2_ws
colcon build 

Let’s see if our new package is recognized by ROS 2.

Either open a new terminal window or source the bashrc file like this:

source ~/.bashrc
ros2 pkg list

You can see the newly created package right there at the top.

8-cobot-arm-examples

Install Useful Packages (Optional)

In a month or so, I will begin building a robotic arm. The package in this tutorial will serve as the foundation for the ROS 2 software.

Let’s install some useful packages that will help us along the way.

Begin by installing a tool called Terminator. Terminator will enable you to have multiple terminal panes within a single interface.

Open a terminal window, and type the following commands:

sudo apt-get update -y
sudo apt-get upgrade -y
sudo apt-get install terminator

To open terminator, you can either click the 9 dots in the bottom left of your Desktop and search for “terminator”….or you can type terminator in a regular terminal window.

You can use CTRL + Shift + E or CTRL + Shift + O to split the terminal window into different panels.

Let’s install some useful ROS 2 packages. Open a terminal window, and type the following:

sudo apt-get install ros-$ROS_DISTRO-gazebo-ros
sudo apt-get install ros-$ROS_DISTRO-gazebo-ros2-control
sudo apt-get install ros-$ROS_DISTRO-joint-state-publisher-gui
sudo apt-get install ros-$ROS_DISTRO-moveit
sudo apt-get install ros-$ROS_DISTRO-xacro
sudo apt-get install ros-$ROS_DISTRO-ros2-control
sudo apt-get install ros-$ROS_DISTRO-ros2-controllers
sudo apt-get install libserial-dev
sudo apt-get install python3-pip
pip install pyserial

If you want to use Amazon Alexa Voice Assistant down the road to control your robotic arm, install the following:

pip install ask-sdk
pip install flask
pip install flask-ask-sdk

Configure Colcon

colcon is the primary command-line tool for building, testing, and installing ROS packages.

In your terminal window, type the following command:

echo "source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash" >> ~/.bashrc

That’s it! Keep building!

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 ChatGPT Will Impact Robotics

What is ChatGPT?

ChatGPT is a large language model chatbot developed by OpenAI. It is a powerful tool that can be used for a variety of tasks. You can use it to generate text, translate languages, write different types of content, write code, and answer your questions.

1-what-is-chatgpt

Imagine a big computer with a lot of books, blog articles, form posts, academic articles, and written Internet content inside of it. ChatGPT is like a robot friend who can read all of that content and answer your questions. It can also generate new stories, poems, songs, and even code.

To use ChatGPT, you just need to talk to it like you would a friend. You can ask it questions about anything, and it will try its best to answer them. You can also give it instructions, and it will try to follow them.

For example, you could say to ChatGPT, “Tell me a story about a dragon.” And ChatGPT would tell you a story about a dragon. Or you could say, “Write me a poem about a cat.” And ChatGPT would write you a poem about a cat.

ChatGPT is still under development, but it is already amazingly good at generating human-like text. It can be a lot of fun to talk to ChatGPT, and it can also be a helpful tool for learning and creativity.

How Will ChatGPT Change the Way We Interact With and Design Robots?

Natural Language Programming

2-nlp

ChatGPT can be used to program robots in a natural language format. This would make it possible for people to interact with robots without having to learn complex programming languages. This would make robotics more accessible to a wider range of people, including non-technical users.

Adaptive Robots

ChatGPT can help robots to adapt to their environment and learn from their experiences. This would make robots more intelligent and capable of handling complex tasks. For example, ChatGPT could be used to train a robot to perform a new task by simply giving it a natural language description of the task.

Collaborative Robots

3-collaborative-robots

ChatGPT can be used to enable robots to collaborate with each other and with humans. This would make it possible to create teams of robots that can work together to solve complex problems. For example, ChatGPT could be used to detail the actions of a team of robots that are working together to build a house.

How Will ChatGPT Impact Business?

ChatGPT could lead to a wide range of new and innovative applications for robots in a variety of industries.

Here are some specific potential use cases:

Manufacturing

4-manufacturing

ChatGPT could be used to program robots to perform complex manufacturing tasks, such as assembling products or inspecting parts for defects. This could help to improve the efficiency and quality of manufacturing processes.

Logistics

5-logistics

ChatGPT could be used to program robots to pick and pack items in warehouses or deliver packages to customers. This could help to improve the efficiency and accuracy of logistics operations.

Healthcare

6-healthcare

ChatGPT could be used to program robots to assist with patient care tasks, such as administering medication or transporting patients. This could help to free up nurses and doctors to focus on more complex tasks.

ChatGPT could be used to develop medical robots that can interact with patients in a more humane and empathetic way.

Education

7-education

ChatGPT could be used to create educational robots that can teach students about a variety of subjects. This could make learning more engaging and effective for students.

ChatGPT could be used to develop educational robots that can tailor their lessons to the individual needs of each student.

Customer Service

8-customer-service

ChatGPT could be used to power customer service robots that can understand and respond to complex customer inquiries in a natural and helpful way.

Examples of Robots Using ChatGPT Today

Here are a couple of specific examples of robots using ChatGPT today:

Levatas Spot Robot

9-levatas-robot

Levatas has developed a way to control Boston Dynamics Spot robots using ChatGPT voice commands. This allows operators to control the robots more naturally and hands-free, and to perform tasks that are difficult to program using traditional methods.

AMECA Humanoid Robot

10-ameca-robot

The AMECA humanoid robot has been used to demonstrate the conversational capabilities of ChatGPT. The robot can answer questions in a comprehensive and informative way, and can even engage in small talk.

ChatGPT is still under development, but it has the potential to revolutionize the field of robotics. By making robots more intelligent, adaptable, and collaborative, ChatGPT could lead to a wide range of new and innovative applications for robots in a variety of industries.

Keep building!