Skip to content

Environment Setup

Tyler Z edited this page Apr 29, 2023 · 4 revisions

General Setup

Editor

The majority of MATE ROV software is written in Python, with a dollop of C++ for added flavor. Most of us use Visual Studio Code or PyCharm for editing. VSCode is a general-purpose editor, so go with that if you don't have either.

OS

Our surface computer runs on Ubuntu. If you already use Ubuntu, skip this section. If you're on a Mac, much badness; talk to your friendly neighborhood software lead about setting up an Ubuntu USB stick or installing an Ubuntu VM. If you're on Windows, do the following to install the Windows Subsystem for Linux:

Open PowerShell with admin permissions (⊞ Win + s > type powershell > Run as Administrator)

Run wsl --install

Restart your machine

See the official installation instructions for more info.

ROS 2 Galactic

Automatic installation

Open a new Ubuntu terminal (on Windows: ⊞ Win + s > type ubuntu > Ubuntu on Windows)

First, install curl to be able to download our install script

sudo apt install curl

Download the install script

curl -o install.sh https://raw.githubusercontent.com/cwruRobotics/rov-23/main/surface/surface_main/scripts/ROS2-Install-Galactic.sh

Run the install script

source install.sh

If there are failures, try the manual installation.

Manual Installation

Open a new Ubuntu terminal (on Windows: ⊞ Win + s > type ubuntu > Ubuntu on Windows)

Run locale and make sure the output includes a LANG= line with UTF-8 at the end

Run apt-cache policy | grep universe and make sure the output includes something like

500 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages
     release v=20.04,o=Ubuntu,a=focal,n=focal,l=Ubuntu,c=universe,b=amd64

If it doesn't or you aren't sure (make sure the word focal is in there!), run sudo apt install software-properties-common and sudo add-apt-repository universe

Now run the following:

sudo apt update && sudo apt install curl gnupg lsb-release

lsb_release -a.

sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(source /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null

sudo apt update

sudo apt upgrade

sudo apt install ros-galactic-desktop

Add an automatic setup script to your startup file if you don't have it already:

grep "source /opt/ros/galactic/setup.bash" ~/.bashrc

If the previous command did not return source /opt/ros/galactic/setup.bash, then run echo 'source /opt/ros/galactic/setup.bash' >> ~/.bashrc.

Test the Installation

Open a terminal and run

ros2 run demo_nodes_cpp talker

You should see messages being published.

Open a second terminal and run

ros2 run demo_nodes_py listener

You should see messages being received from the talker.