HITL on VOXL2

The following is a low level explanation of hardware and software required to get HITL running on the voxl2

Hardware Required:

  1. FTDI Cable (USB to serial) connected to a 4-pin JST. Don’t connect the power line! Only ground, transmit, and receive. Note the photo below as an example:

  1. Host computer that is capable of running gazebo (Ubuntu 18.04/20.04/22.04 or MacOS)

  2. VOXL 2 (Running SDK 1.0.0 OR HIGHER) + power source (recommended power regulator from outlet to xt60)

  3. VOXL 2 Breakout USB hat + WiFi Adapter (optional - needed for qgc connection)

  4. USB-C to USB-A adapter

Hardware Setup:

  1. Connect parent computer capable of running gazebo to usb-a side of FTDI cable

  2. Connect 4-PIN JST of FTDI to port J18 (esc dsp port) on the VOXL 2

  3. Using USB-A to USB-C adapter, connect the usb-C endpoint to the VOXL 2 and the usb-A endpoint to parent computer

  4. Ensure both parent computer and VOXL 2 both have power!

Software Setup:

Parent Computer Setup:

  1. Open a terminal window on parent computer

  2. On computer running either MacOS or Ubuntu (18.04/20.04/22.04) ensure you have docker installed - if not, proceed to install it following the instructions here: https://docs.docker.com/engine/install/

  3. Once docker has been installed and enabled, proceed to run the following steps to get a docker instance of gazebo running on the parent computer:

    1. wget https://storage.googleapis.com/modalai_public/modal_dockers/voxl-gazebo-docker_v1_2.tgz

    2. docker load < voxl-gazebo-docker_v1_2.tgz

    3. docker tag voxl-gazebo-docker:v1.2 voxl-gazebo-docker:latest

  4. The above will pull down the most recent gazebo instance running on a ubuntu image - it will be capable of being run on any linux based device

  5. In order to share X11 (the screen forwarding software) to allow docker to access the screen of the parent computer, proceed to run the following: xhost +

  6. The user now has the ability to run the gazebo instance in both standard GUI mode, as well as headless:

    1. GUI Mode: docker run --rm -it --net=host --privileged -e DISPLAY=$DISPLAY -v /dev/input:/dev/input:rw -v /tmp/.X11-unix:/tmp/.X11-unix:ro voxl-gazebo-docker ./run_gazebo.bash

    2. Headless Mode: docker run --rm -it --net=host --privileged -v /dev/input:/dev/input:rw voxl-gazebo-docker ./run_headless.bash\

VOXL 2 Setup:

  1. From the parent computer, open a terminal window and run the following to get into the VOXL 2 environment: adb shell

  2. Once in the VOXL 2 proceed to disable and stop the onboard voxl-px4 instance running via: systemctl stop voxl-px4

  3. Run voxl-inspect-services to ensure voxl-px4 is no longer running (can still be enabled)

  4. We will then need to stop QVIO server onboard to ensure no conflicting odometry packets get sent to the PX4 instance when we do run HITL - by this, it is meant that odometry can be produced from HITL if we run visual gazebo enviornment, as well as odometry from QVIO - these can conflict and cause erroneous flight in the simulation - proceed to run systemctl stop voxl-qvio-server

  5. Once QVIO server has been stopped, proceed to launch the HITL px4 instance in the VOXL 2 terminal window by running voxl-px4-hitl - this will launch PX4 in HITL mode!

  6. To verify HITL is running, please in px4-shell run qshell dsp_hitl status - you should see the following:

Running Commands

Now that both the parent computer is running the gazebo docker instance, and the HITL px4 instance is running on the VOXL 2, we can run commands to actively control the drone - of which are things like:

  1. qshell commander takeoff

  2. qshell commander land

Furthermore, if the user wishes to fly the drone via a joystick, they can do so via QGC - this is where WiFi comes into play - the user can connect to the active PX4 instance via a comm link or via mavlink-server and use the onboard joysticks in QGC to fly the drone around!

Note - in order to connect to QGC - the user must turn off autoconnect for serial connections in QGC as the QGC instance might pickup on the FTDI connection of mavlink messages, whereas we want it to connect to the UDP connection.

Last updated