Skip to main content

Installing ROS

In This Tutorial...

Now that we've finally set up our computers and established a network connection, we can go about installing ROS! This isn't actually very hard, and although the official documentation is quite detailed, it can be kind of hard to know where a beginner should start (at time of writing anyay), so this post is mostly just to point you in the right direction for the basics.

Installing the main packages

First we need to install the main set of ROS packages. Head over to this link and follow the instructions to install ROS on both machines. Don't worry about the optional steps at the end ("Using the ROS 1 bridge" and "Additional RMW implementations").

Remember that in the last tutorial we set up SSH on the Pi, so you should be able to do all of this from the dev machine with two terminals open - one local and one with an SSH connection to the Pi.

Install Terminals

If the talker and listener steps worked correctly then congratulations, you've installed ROS!

Testing over the network

Now that ROS is installed on both machines, it's worth testing that ROS can communicate properly over the network. We'll run the demo talker and listener again, but this time we want to have the talker on one machine (the Pi in the example below), and the listener on the other.

Comms test

Install Colcon

Next we need to install the build tool, colcon (I'm not sure why this isn't included as part of the core ROS installation). All we need to do is run:

sudo apt install python3-colcon-common-extensions

For a more complete set of colcon instructions, see this link.

Environment tweaks

While following the main ROS installation, you might have noticed that we had to run source /opt/ros/foxy/setup.bash a bunch of times. This line tells that terminal how to access ROS, and if we try to run any ROS commands without that line having been run earlier, it won't work. You have to run this once per terminal window, which can get pretty tedious. To help with this, we can add that line to the bottom of the file ~/.bashrc , which the computer automatically executes in the background every time we open a terminal.

Running the following command will add this line for us, and each new terminal opened after that will "see" ROS.

echo "source /opt/ros/foxy/setup.bash" >> ~/.bashrc

Once we've done that on both machines, we can close and reopen our terminal windows. We should now be able to run the demo talker and listener again without needing to run the "source" command first.

For a couple of other environment tweaks (including a useful command colcon_cd), see this page

Up Next...

In the next tutorial we'll see an overview of ROS and some of the key pieces of functionality, and after that we'll be creating our first package.