Installing ROS on Linux (Ubuntu 20.04)¶
Applicable to: Those who have access to a computer running Ubuntu 20.04 (either natively or via WSL).
If you have Ubuntu 20.04 running on a machine then follow the steps below to install ROS and all the additional packages required for this ROS Course:
-
Install ROS Noetic (the instructions that follow are largely taken from the ROS.org website):
-
Set up your system to accept software from packages.ros.org:
-
Set up your keys (using
curl
): -
Make sure your package index is up-to-date:
-
Install the "Desktop-Full" version of ROS:
-
-
Set up your environment.
-
A ROS script must be sourced in every bash terminal you use ROS in, so it's best to add a line to the end of your
~/.bashrc
so that this occurs automatically whenever you open a terminal: -
Re-source your environment for the changes to take effect:
-
-
Install dependencies for building packages
"Up to now you have installed what you need to run the core ROS packages. To create and manage your own ROS workspaces, there are various tools and requirements that are distributed separately. For example, rosinstall is a frequently used command-line tool that enables you to easily download many source trees for ROS packages with one command."
-
Initialize
rosdep
:"Before you can use many ROS tools, you will need to initialize rosdep. rosdep enables you to easily install system dependencies for source you want to compile and is required to run some core components in ROS."
-
Install 'Catkin Tools'. This is optional. By default,
catkin_make
can be used to invoke CMake for building ROS packages, but we usecatkin build
instead (because it's a bit nicer!) See how to install Catkin Tools here, if you want to. -
Create and build a Catkin Workspace:
-
Make the directories:
-
Navigate into the root folder:
-
Then if you installed Catkin Tools:
... and if not, then its:
-
Then you need to add this to the end of your
~/.bashrc
as well: -
And finally, re-source:
-
-
Install the TurtleBot3 packages, based on the Robotis instructions:
-
First, install dependencies:
sudo apt-get install ros-noetic-joy ros-noetic-teleop-twist-joy \ ros-noetic-teleop-twist-keyboard ros-noetic-laser-proc \ ros-noetic-rgbd-launch ros-noetic-rosserial-arduino \ ros-noetic-rosserial-python ros-noetic-rosserial-client \ ros-noetic-rosserial-msgs ros-noetic-amcl ros-noetic-map-server \ ros-noetic-move-base ros-noetic-urdf ros-noetic-xacro \ ros-noetic-compressed-image-transport ros-noetic-rqt* ros-noetic-rviz \ ros-noetic-gmapping ros-noetic-navigation ros-noetic-interactive-markers
-
Then, install the TurtleBot3 packages themselves:
-
And then add some environment variables to your
~/.bashrc
too, in order for ROS and the TurtleBot3 packages to launch correctly:
-
-
Next, install some other useful Python tools:
-
Finally, install the Course Repo:
-
Navigate to your Catkin Workspace:
-
Download the repo from GitHub:
-
Then, if you installed Catkin Tools:
... if not, do this:
-
And finally, re-source again:
-
-
For convenience, we use some Bash Aliases to make it easier to call some common ROS commands. You might want to create a
~/.bash_aliases
file with the following content (or add to an existing one):alias tb3_teleop="rosrun turtlebot3_teleop turtlebot3_teleop_key" alias tb3_world="roslaunch turtlebot3_gazebo turtlebot3_world.launch" alias tb3_empty_world="roslaunch turtlebot3_gazebo turtlebot3_empty_world.launch" alias tb3_slam="roslaunch turtlebot3_slam turtlebot3_slam.launch" alias tb3_rviz="roslaunch tuos_simulations rviz.launch" # This one's quite useful too: alias src="echo 'Sourcing bashrc...' && source ~/.bashrc"