Skip to content

2. Setting up your environment

Imad Issafras edited this page Jul 23, 2024 · 22 revisions

Docker for tool set + Gazebo-classic

Docker

Where to find the image bla bla bla TODO!!! Note to self, to install gazebo-classic,

sudo apt remove gz-garden
sudo apt install aptitude
sudo apt autoremove
sudo aptitude install gazebo libgazebo11 libgazebo-dev

Gazebo

We need Gazebo version 11.10.2 running natively, Gazebo is the simulator we use. We will do so by using the Conda package manager.

  1. Install MiniConda by selecting the right installer for your OS, make sure to check the add to PATH box during the installation to not have to do it manually later
  2. Open the command prompt
    • Search for cmd.exe on Windows
    • Search for Terminal on MacOS
  3. Run
conda install mamba -c conda-forge
conda install git 

in the prompt

  • Mamba is a faster Conda, utilizing multithreading
  1. Once that's done, run
mamba create -n ros_env python=3.11
mamba activate ros_env
  • This creates a Conda environment which is self contained, similar to a python venv, named "ros_env"
  • Then you run mamba activate to enter said environment
  • This should prefix your prompt with "(ros_env)"
  • Later you can run mamba deactivate to exit the environment
  • More on managing conda environments here
  1. Run
conda config --env --add channels conda-forge
conda config --env --add channels robostack-staging
conda config --env --remove channels defaults
  • This ensures packages are installed from conda-forge or robostack-staging
  1. Install Gazebo 11.10.2 by running conda install gazebo=11.10.2
  2. Once the install is done, close your terminal
  3. From a new terminal, run mamba activate ros_env, then try running gazebo --version
    • This should not throw an error
  4. Run gazebo in your terminal, this should open a GUI
  5. Close the GUI (either CTR+C from the terminal or press the x at the top right of the gazebo GUI)
  6. From the terminal change directory into your home directory
  • In Mac and Linux, this can be done with cd ~
  • In Windows, cd %userprofile%
  1. Run
cd .gazebo
git clone https://github.com/PX4/PX4-gazebo-models.git
  • We need the various meshes and scripts inside this repository so that our gazebo client can render the simulation properly
  1. Move all of the files and folders of the cloned repository to the .gazebo directory

Running Sim (TO REMOVE, put here for self)

Run the docker container using docker run -it --privileged -e DISPLAY:=0 -p 14570:14570/udp -p 11345:11345 unhappysquid/drone_a1. From the docker container, run HEADLESS=1 GAZEBO_IP=$(ip a | grep 'eth0' -A 3 -m 1| grep 'inet' | awk '{print $2}' | awk -F"/" '{print $1}') make px4_sitl gazebo-classic_standard_vtol. From the native environment, open your terminal, activate your conda environment, run gzclient --verbose

Getting Git, ROS 2, Gazebo simulator, PX4 firmware, QGroundControl, Tmux

Optional tools

Considered approaches (For future lead's reference)

We want a way to have our system run the simulation smoothly to make development enjoyable, this requires GPU accelerated graphics. In the case of a graphics card that is within the same chip as the CPU, a virtual machine or WSL should work fine. The issue arises when the computer has a dedicated GPU, thus making it complicated for the simulator to access the GPU from a virtual machine. Without a hypervisor type 1, only one OS can use the GPU at a time, meaning only the host OS uses the GPU, meaning no GPU for our virtual machine. Not to mention that a good proportion of students use mac, so our solution should be OS agnostic.

  1. Dual booting
    • - Non-trivial to set up
    • - Not universal, notably, complicated on Mac.
    • - Trickier to restart from 0 than virtual machines
    • + Bare metal performance
  2. WSL by itself
    • - Requires Windows machine
    • - Doesn't work with some GPUs, notably Intel Iris Xe GPU
    • + Supports most GPUs
    • + As easy to experiment with as any virtual machine, can always scrap it and restart from new
  3. Virtual machine by itself
    • Doesn't work with GPUs at all
  4. Docker for tool set + Gazebo ignition running natively
    • + Can easily share an image with all the tools needed for development
    • Supported platforms for gazebo
    • - Gazebo's Windows support doesn't include the GUI at the time of writing
    • - Untested on Mac
  5. Docker for tool set + AirSim running natively
    • + Can easily share an image with all the tools needed for development
    • + Runs on top of Unreal Engine, making it ideal for realistic computer vision
    • - AirSim doesn't work on MacOS
    • - Microsoft, AirSim's developers, have stopped working on it since 2022
      • Colosseum is a successor to AirSim which supports PX4, sadly only for multi rotors as well
    • - Only supports PX4 multi rotor, no VTOL
  6. Docker for tool set + Gazebo-classic
    • + Can easily share an image with all the tools needed for development
    • - Gazebo-classic is reaching end of life in 2025
      • Hopefully by the time it reaches end of life, gazebo ignition will work on more than just linux
    • + Easy to setup
    • + Uses Conda which is cross-plateform
    • + Gazebo classic works on all platforms (supposedly), meaning simulation is running natively
Clone this wiki locally