EP3.1 - How to install ROS
Video: https://youtu.be/uWzOk0nkTcI
#Robotics #Hardware #ROS #LinuxRead more here
Table of Contents:
Introduction: Installing ROS
Welcome back to our series on getting ready to build robots with ROS. Today, we’re finally going to be installing ROS, so let’s get stuck into it!
Recap: What We’ve Covered So Far
In this series, we’ve been setting up a development environment for ROS. We’ve:
- Set up our hardware
- Installed Linux
- Configured our network
Now, it’s time to install ROS!
Installing ROS: Getting Started
Installing ROS is actually quite easy, though the documentation on the ROS website can sometimes be overwhelming for beginners. I’m going to walk you through the steps to simplify the process.
Step 1: Installing ROS2 via Debian Packages
As you can see, I’ve got the Pi open on the left (via SSH), and the local terminal of the development machine on the right.
First, head over to the "Installing ROS2 via Debian Packages" page.
For now, we only need to follow the Setup Sources and Install ROS2 Packages steps.
- Copy and paste the five commands from the documentation, making sure to install the desktop version of ROS Foxy on both machines.
ROS Foxy refers to a specific version of the Robot Operating System (ROS), more specifically ROS 2. Each release of ROS has a code name, and "Foxy" is the code name for ROS 2 Foxy Fitzroy, which was released in June 2020. It’s part of the ROS 2 distribution series and is a long-term support (LTS) release, meaning it will receive updates and support for a longer period (typically 5 years) compared to non-LTS versions.
- Then, wait for the installation to complete.
Step 2: Testing ROS Over the Network
Next, the tutorial suggests testing ROS on individual machines, but we’ll take it a step further and test whether it works over the network.
Here’s what we’ll do:
- Run the source command (in both terminals). We will talk more about this command later. We will make a tweak to avoid running this command manually every time we use the terminal
- Run the demo talker on the Pi and the demo listener on the development machine.
In the Pi terminal (talker):
source /opt/ros/foxy/setup.bash
ros2 run demo_nodes_cpp talker
In the Dev Machine terminal (listener):
source /opt/ros/foxy/setup.bash
ros2 run demo_nodes_py listener
- If everything’s working correctly, you should see the messages coming through.
Note: If network testing fails, you can always follow the tutorial to test each machine individually.
Step 3: Installing Colcon Build Tool
The next step is to install the ROS2 build tool called Colcon. I’m not sure why this isn’t included in the desktop installation packages, but it’s necessary.
- Run the following command to install it in both the Pi and Dev Machine:
Copy to Terminal:
sudo apt install python3-colcon-common-extensions
- After that, quickly check that it’s installed by running
colcon
in both machines.
Step 4: Configuring the Terminal Environment for ROS
Even though we’ve installed ROS, the system doesn’t automatically recognize it. This is because ROS allows multiple versions to be installed at once without conflicts. To activate ROS for a terminal session, you need to run the source command.
Running the source command every time can be a bit annoying, so most people add the command to a file called bashrc. This file runs automatically whenever a new terminal is opened.
- To add the source command to bashrc, run this command in both machines:
Copy to Terminal:
echo "source /opt/ros/foxy/setup.bash" >> ~/.bashrc
Now, when you close and reopen your terminals, you won’t need to manually run the source command every time.
For example, we can Run the Talker and Listener Demo without running the Source Command manually first.
Additional Configuration Options and Conclusion
There are other configurations you can explore to further customize your ROS environment. If you’re interested, check out the Configuring Your ROS Environment page for more details.
Conclusion: What’s Next?
That’s it for installing ROS! In the next video, we’ll go over an overview of ROS and some of its core functionalities. I’ll see you next time!
Z) 🗃️ Glossary
File | Definition |
---|
Uncreated files | Origin Note |
---|