-
Notifications
You must be signed in to change notification settings - Fork 8
Working On Your Own Computer
We have set up the WSL-ROS environment specifically for this COM2009 lab course to ensure that you have all the right packages and tools available to you. Of course, this requires you to work on a University Managed Computer and - naturally - you may want to be able to work through this course material (and explore further) on your own device instead.
If you already have Ubuntu 20.04 running on a machine then follow the steps below to install ROS and all the additional packages required for the COM2009 lab course:
-
Install ROS Noetic (the instructions that follow are largely taken from the ROS.org website):
-
Setup your computer to accept software from packages.ros.org:
$ sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
-
Set up your keys (using
curl
):$ curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
-
Make sure your package index is up-to-date:
$ sudo apt update
-
Install the "Desktop-Full" version of ROS:
$ sudo apt install ros-noetic-desktop-full
-
-
Set up your environment.
-
A 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
:source /opt/ros/noetic/setup.bash
-
Re-source your environment for the changes to take effect:
$ source ~/.bashrc
-
-
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."
$ sudo apt install python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential
-
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."
$ sudo rosdep init $ rosdep update
-
Install 'Catkin Tools'. This is optional. By default,
catkin_make
can be used to invoke CMake for building ROS packages, but in the COM2009 Wiki, 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:
$ mkdir -p ~/catkin_ws/src
-
Navigate into the root folder:
$ cd ~/catkin_ws/
-
Then if you installed Catkin Tools:
$ catkin build
... if not, then its:
$ catkin_make
-
Then you need to add this to the end of your
~/.bashrc
as well:source ~/catkin_ws/devel/setup.bash
-
And finally, re-source:
$ source ~/.bashrc
-
-
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:
$ sudo apt install ros-noetic-dynamixel-sdk $ sudo apt install ros-noetic-turtlebot3-msgs $ sudo apt install ros-noetic-turtlebot3 $ sudo apt install ros-noetic-turtlebot3-simulations
-
And then add some environment variables to your
~/.bashrc
too, in order for ROS and the TurtleBot3 packages to launch correctly:export TURTLEBOT3_MODEL=waffle export ROS_MASTER_URI=http://localhost:11311 export ROS_HOSTNAME=localhost
-
-
Next, install some other useful Python tools:
-
Install Pip:
$ sudo apt install python3-pip
-
And use Pip to install Pandas:
$ pip3 install pandas
-
-
Finally, install the COM2009 ROS packages:
-
Navigate to your Catkin Workspace:
$ cd ~/catkin_ws/src/
-
Download the repo from GitHub:
$ git clone https://github.com/tom-howard/COM2009.git
-
Then, if you installed Catkin Tools:
$ catkin build
... if not, do this:
$ cd ~/catkin_ws/ $ catkin_make
-
And finally, re-source again:
$ source ~/.bashrc
-
-
For convenience, we use some Bash Aliases to make it easier to call some of the common ROS commands for the COM2009 course. You might want to create a
~/.bash_aliases
file with the following content (or add to an existing one):alias tb3_teleop="roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch" 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="rosrun rviz rviz -d \`rospack find turtlebot3_description\`/rviz/model.rviz" # This one's quite useful too: alias src="echo 'Sourcing bashrc...' && source ~/.bashrc"
Refer to the Windows Subsystem for Linux Documentation for instructions on how to install and use WSL on Windows 10 or 11.
Ubuntu 20.04 should be installed by default when you install WSL but if not, or if you want to create an additional WSL distribution then see here.
We'd also recommend installing the Windows Terminal App.
Launch your Ubuntu 20.04 distro and then follow the steps for Installing ROS and the COM2009 Packages above.
Graphical Applications are only supported natively in WSL when running on Windows 11 so if you're running Windows 10, then you will need to follow the additional steps below to get GUI apps (such as Gazebo and RViz) working...
First, you'll need to install the VcXsrv Windows X Server. You'll need to make sure you have this running before trying to launch any GUI applications from WSL (Gazebo simulations etc.) To make this easier, we've created a configuration file. Download this file, save it on your desktop and double click it to launch an X Server on your machine with the appropriate configurations. Once launched, an icon should be visible in your notification tray in the bottom right-hand corner of the Windows Desktop:
In Ubuntu, you'll need to then add the following lines to your ~/.bashrc
:
export DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2>/dev/null):0
export LIBGL_ALWAYS_INDIRECT=
export GAZEBO_IP=127.0.0.1
COM2009/3009 Robotics Lab Course
Updated for the 2021-22 Academic Year
Dr Tom Howard | Multidisciplinary Engineering Education (MEE) | The University of Sheffield
The documentation within this Wiki is licensed under Creative Commons License CC BY-NC:
You are free to distribute, remix, adapt, and build upon this work (for non-commercial purposes only) as long as credit is given to the original author.