Skip to content

Development VM Setup

ttchalakov edited this page Oct 13, 2023 · 52 revisions

IRIS Development Environment Setup

Warning

This page is being updated and not reliable. Refer to the scripts in the install_scripts folder in the repo.

The IRIS development environment is meant to be consistent among all collaborators as time spent configuring dependencies removes time from developing meaningful robot systems. This can be tricky as our development environment requires not only specific dependencies but also a specific operating system. Therefore it is recommended to develop in a virtual machine (vm) such that all development is isolated from the developer's host operating system so any changes to dependencies can be quickly and safely made. This is also necessary for students to keep their host operating system safe from any operating system level changes that might be done in the vm. The recommended and guaranteed way to setup your development environment is to use the preconfigured vm we provide.

Host Operating System Options

VMWare Installation Instructions

  • Download and Install VMWare Workstation Player.
    • No license key is needed and it is recommended that the enhanced keyboard drivers be installed during the setup process.

Preconfigured VM Setup Instructions

  • Open WMware Workstation Player
  • Select "Open A Virtual Machine"
  • Navigate to the preconfigured VM folder, open that folder and select the .vmx file. Press "Open".
    • Select "Copied It" when prompted.
  • Open the terminal application and run the following:
sudo apt-get -y update && sudo apt-get -y upgrade
  • Clone the GitHub repo into the "~/colcon_ws/src" folder using the following command.
cd ~/colcon_ws/src && git clone https://github.com/IllinoisRoboticsInSpace/IRIS.git
  • Install Repo Dependencies and Make Packages Available in ROS
cd ~/colcon_ws
rosdep install --from-paths src --ignore-src --skip-keys=librealsense2 -r --rosdistro $ROS_DISTRO -y
colcon build
source ~/colcon_ws/install/setup.bash

Preconfigured IRIS VM Credentials:

  • Username: iris
  • Computer name: iris-vm
  • Password (The literal space character): " "

Detailed VM Setup Instructions

Download Corresponding Ubuntu Image

Configure VMWare Virtual Machine

  • In the home menu select "Create a New Virtual Machine"
  • Select "Browse" and select the Ubuntu image.
  • Set the Easy Install Information to that in the VMWare Installation Instructions section.
    • The "Full Name" can be set to the "User name".
  • Set the "Virtual machine name" in our case we use "Ubuntu 20 Galactic IRIS Base VM" and choose a location to store it (it is recommended to name the folder as the name of the virtual machine.
  • Set the "Maximum disk size (GB)" to at least 30 GB.
    • Select "Split virtual disk into multiple files"
  • Select "Customize Hardware" and set the following:
    • Set the RAM to a minimum of 5GB (5120 MB).
    • Set the number of processors to 4.
    • Select the "Printer" device and click "Remove"
  • Power on the virtual machine to complete the installation process.

Ubuntu Installation

  • Select Keyboard
  • Select Minimal Installation
  • Select "Erase disk and install Ubuntu"
    • Press "Install Now" and "Continue"
  • Select Timezone and press "Continue"
  • Set to "iris"
  • Set <Your computer's name> to "iris-vm"
  • Set to "iris".
  • Set and to " ". Literally just the space character.
  • Skip "Online Accounts", Press Next on "Livepatch", Select "No, don't send system info", Press Next, Press Next on "Welcome to Ubuntu", Select Done on "Ready to go".
  • If the Software Updater application opens up close it.

Installing ROS 2

Setup ROS 2 Install using debian packages by running the following commands in order:

sudo apt update -y && sudo apt install -y locales
sudo locale-gen en_US en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
export LANG=en_US.UTF-8
sudo apt update -y && sudo apt install -y curl gnupg lsb-release
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 -y
sudo apt upgrade -y
echo "export ROS_DOMAIN_ID=1" >> ~/.bashrc

Install Humble:

sudo apt install -y ros-humble-desktop
echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc
mkdir -p ~/colcon_ws/src # Makes colcon workspace location
source /opt/ros/humble/setup.bash

Install Galactic:

sudo apt install -y ros-galactic-desktop
echo "source /opt/ros/galactic/setup.bash" >> ~/.bashrc
mkdir -p ~/colcon_ws/src # Makes colcon workspace location
source /opt/ros/galactic/setup.bash

Install Necessary Utilities: git, colcon, rosdep

sudo apt-get install -y git python3-colcon-common-extensions python3-rosdep
sudo rosdep init # Can fail if already initialized previously, therefore disregard error
rosdep update --rosdistro=$ROS_DISTRO

Install Nav2

sudo apt install -y ros-$ROS_DISTRO-navigation2 ros-$ROS_DISTRO-nav2-bringup

Install Arduino Environment Material

Install Realsense SDK

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE || sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE
sudo add-apt-repository "deb https://librealsense.intel.com/Debian/apt-repo $(lsb_release -cs) main" -u
sudo apt-get install librealsense2-dkms librealsense2-utils librealsense2-dev librealsense2-dbg
cd ~/colcon_ws/src/
git clone https://github.com/IntelRealSense/realsense-ros.git -b ros2-development
cd ~/colcon_ws
rosdep install -i --from-path src --rosdistro $ROS_DISTRO --skip-keys=librealsense2 -y
colcon build
source ~/colcon_ws/install/setup.bash
#TODO

(Optional) Install Rtabmap

cd ~/colcon_ws
git clone https://github.com/introlab/rtabmap.git src/rtabmap
git clone --branch ros2 https://github.com/introlab/rtabmap_ros.git src/rtabmap_ros
rosdep install --from-paths src --ignore-src --skip-keys=librealsense2 -r -y
export MAKEFLAGS="-j$(nproc)"
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release

Extra Installation Instructions

  • Go into the "Ubuntu Software" app and install vscode.
  • Remove all attached CD/DVD and Floppy disks from the VM using the VM settings menu while the VM is powered off.
  • Go to the Ubuntu settings under "Power" and set "Screen Blank" to "Never".
  • Adding utility commands:
    • Adding setup script for custom ROS packages in your colcon workspace:
      echo "source ~/colcon_ws/install/setup.bash" >> ~/.bashrc
      Note: You will still have to source the install/setup.bash script each time you build to ensure the package is updated
    • Making it easier to colcon build and source ./install/setup.bash with a custom bash function
      function build() {
      if [ $# == 0 ]; then
        echo "colcon build"
        colcon build
      else 
        echo "colcon build --packages-select" $@
        colcon build --packages-select $@
      fi
      echo "Sourcing install/setup.bash"
      source ./install/setup.bash
      }
      • Usage when inside a colcon workspace
        • buildcolcon build
        • build <pkg_names>colcon build --packages_select <pkg_names>
  • Option: Increase Swap Size (link):
sudo swapoff /swapfile
sudo rm  /swapfile
sudo dd if=/dev/zero of=/swapfile bs=1M count=16384
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

Installation Issues

  • If xacro and diagnostic-updater are not found by rosdep, install them manually using sudo apt-get install ros-galactic-xacro ros-galactic-diagnostic-updater