Skip to content

Working On Your Own Computer

Alex Lucas edited this page Mar 29, 2022 · 8 revisions

We have set up the WSL-ROS environment specifically for this COM3528 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.

Note: Please be aware that you won't be able to connect to physical MiRos from your own computer due to network restrictions!

[Update] You can use the installer script available here, to automate the installation process that is described below (except VS Code).

Quick Links

Native installation on Ubuntu 20.04

The first option you can go for is to install all the required packages natively on Ubuntu. Detailed guidance on how to install Ubuntu 20.04 are out of scope of this guide, but some pointers are given below:

  • You can download the latest Ubuntu 20.04 image from the official website.
  • You'll need to write that image on a 4GB+ USB flash drive, in order to convert it into a bootable installation drive. We recommend using the Rufus software for this purpose.
  • Boot from the USB flash drive and follow the installation instructions. Detailed explanations of all the options can be found on the web.
  • If you have an existing Windows installation, it is possible to preserve it by setting up a dual boot configuration. We recommend using a separate hard drive for this purpose, rather than trying to fiddle with partitions on a single hard drive.

Installing ROS and MDK on Ubuntu 20.04

Installing ROS

Further steps below assume you are on Ubuntu 20.04 and are logged in into an account with sudo (super-user) privileges.
Open the terminal and install the prerequisites

$ sudo apt update
$ sudo apt upgrade
$ sudo apt install chrony ntpdate curl build-essential git
$ sudo ntpdate ntp.ubuntu.com

Add ROS repo and keys, and install ROS packages (make note of the long list - that is all one line):

$ sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
$ curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
$ sudo apt update

$ sudo apt install ros-noetic-desktop-full ros-noetic-rqt-* ros-noetic-gazebo-* 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-amcl ros-noetic-map-server ros-noetic-move-base ros-noetic-rqt* ros-noetic-gmapping ros-noetic-navigation python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential

Deploy, clean-up and reboot

$ sudo rosdep init
$ rosdep update
$ sudo apt upgrade
$ sudo apt autoremove
$ sudo apt autoclean
$ sudo reboot

Install catkin_tools and other MDK dependencies

$ sudo apt install python3-pip
Verify:
$ pip3 --version
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)
$ sudo apt install python3-catkin-tools ffmpeg
$ sudo pip3 install apriltag

Now you should have the necessary packages in the ROS framework to install MDK.

Installing MDK

  1. You can download the latest version of the MDK from CQR's official website via this link.
  2. Move the archive from the Downloads folder to a location of your choice, e.g. ~/src or ~/pkgs. You can use the File Explorer (or Files, as it is properly called) to move files and create folders.

Note: This will be the actual MDK location, since the ~/mdk path you probably got used to by now is only a soft link to this folder created during installation. Be careful not to accidently delete this folder!

  1. Open a terminal window inside the folder with the MDK archive and run the following commands:
$ tar -xvzf mdk_2-210921.tgz
$ cd mdk-210921/bin/script
$ ./install_mdk.sh
  1. Close and re-open any terminal windows and compile the catkin workspace that you will be using for code development, as part of the MDK:
$ cd ~/mdk/catkin_ws/
$ catkin build

Now you can test your installation by launching Gazebo and Client GUI as described in Week 1.

Extras

VS Code

Based on the instructions from here.

Update package index and install dependencies

$ sudo apt update
$ sudo apt install software-properties-common apt-transport-https wget

Import the Microsoft GPG key:

$ wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | sudo apt-key add -

Enable the Visual Studio Code repository:

$ sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main"

Install Visual Studio Code:

$ sudo apt install code

Once done, launch VS Code, trust the workspace and install the following extensions:

  1. Python
  2. Remote-SSH

Installing on Windows using WSL

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 outlined above 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...

Running Graphical Applications in WSL on Windows 10

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=1
export GAZEBO_IP=127.0.0.1

Clone this wiki locally