Skip to content

Setup Ubuntu and ROS

alicezou-ca edited this page Jun 13, 2024 · 17 revisions

Ubuntu Environment

Our dev environment needs Ubuntu 20.04. We need this version of Ubuntu because we want to run the version of ROS called 'noetic'. This is also the environment the base computer is running. We highly recommend running Ubuntu 20.04 LTS natively. This will be by far the smoothest experience. There are many tutorials on dual booting out there if you are not comfortable with daily driving Linux. You will likely need 40-60 GB of space for your Linux partition.

Here are some other options that I recommend

Several methods

  1. Ubuntu 20.04 LTS in a Virtual Machine
  2. Ubuntu Docker container
  3. Ubuntu 20.04 LTS running in WSL

I personally have the Ubuntu 20.04 lts natively (this is the base station computer that controls the rover). I also highly recommend using a virtual machine, if you are not comfortable doing a partition. I run Windows 10 on my main computer, and I simply use VirtualBox to run ubuntu and it works really well. Windows 10 with WSL is probably the worst option here, I find that it is okay to build/compile the code, but cannot interface with USB ports and also no GUIs are available.

This tutorial is pretty good. Just make sure you download the ubuntu 20.04 ISO

The ISO is the thing you upload into the VirtualBox

Link to ubuntu 20.04 ISO https://releases.ubuntu.com/focal/

image

Tutorial to set up virtual machine: https://ubuntu.com/tutorials/how-to-run-ubuntu-desktop-on-a-virtual-machine-using-virtualbox#1-overview

Note: You may need to turn off a setting in your BIOS if you haven't already, to enable virtualization and runs these VMs. Why my VM is returning error

Example of this:

Install ROS

This is the recommended way to install ROS and the only one we will guarantee full support for.

Go through this installation but there is a summary below:

https://wiki.ros.org/ROS/Installation

sudo apt install curl git git-lfs python3-pip -y
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 -y
sudo apt install build-essential
sudo apt install ros-noetic-desktop python3-catkin-tools python3-rosdep -y

Create your catkin_ws and compile uvic_rover

Then create a catkin workspace directory called "catkin_ws" in your home directory, and clone the ROS-rover repo into it (this doesn't have to be called "catkin_ws" and it doesn't have to be directly in your home directory, but these are the standards we use). Also adding "uvic_rover" at the end will name the folder to uvic_rover.

mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
git clone https://github.com/Uvic-Robotics-Club/uvic-rover.git uvic_rover

Next you need to initialize your catkin workspace:

cd ~/catkin_ws/src
source /opt/ros/noetic/setup.bash
catkin_init_workspace

Now use rosdep to install all necessary dependencies:

sudo rosdep init
rosdep update
rosdep install --from-paths ~/catkin_ws/src/ --ignore-src -y --rosdistro=noetic

Now build:

cd ~/catkin_ws
catkin_make

Now that your catkin workspace is ready, you need to source the ROS setup files:

source ~/catkin_ws/devel/setup.bash

This needs to be done every time you open a new terminal session.

You can also automatically source for this setup.bash as well, although this isn't necessarily recommended since it changes environment variables that could cause issues when you work on other things outside of rover. This only causes issues in some special cases, so if you aren't worried about it, feel free to add the second source to your bashrc file. If this is something you want to avoid, you can at least add a shorter command as an 'alias' to run when you open your terminal:

echo "alias source_uvicrover='source ~/catkin_ws/devel/setup.bash'" >> ~/.bashrc

Then you will only have to enter source_uvicrover each time you open a terminal for rover.

Install Rosserial

Rosserial is one of the packages we use to allow ROS to run on microcontrollers.

If you do not already have an Arduino IDE installed, download it from the Arduino website. I can only guarantee the Arduino IDE 1.8.19 (legacy) to work, and I also recommend to get this version. Once installed, launch the application to select your sketchbook location. (See arduino official website, sketchbook is a standard place to store your programs, or sketches). Close the IDE when done.

sudo apt-get install ros-noetic-rosserial-arduino
sudo apt-get install ros-noetic-rosserial

In the steps below, is the directory where the Linux Arduino environment saves your sketches. Typically this is a directory called sketchbook or Arduino in your home directory. e.g cd ~/Arduino/libraries

Make sure you source ROS That period at the end is not a typo

  cd <sketchbook>/libraries
  rm -rf ros_lib
  rosrun rosserial_arduino make_libraries.py .

After restarting your IDE, you should see ros_lib listed under examples

UVic Rover

ROS and Dev environment

Setup Ubuntu and ROS

Fundamentals ROS

Git Workflow

IDE Config

Teleoperation

Moveit/Rviz

Dev Ops and Comms

Updating CI

Communication Design Document

Serial Communication

Setting up the Jetson

Setting up the Base Station

[Setting up RocketM2]

Embedded Software

[System Diagram] [Drive train and Arm]

Phidget Drivers

Navigation

[Cameras]

Localization

Sensors

Clone this wiki locally