Mar 4, 2024

VOXL 2 Essentials Part 2

VOXL 2 Essentials Part 2

If you completed Part 1 of this series, you now know how to connect to your VOXL 2, set up your operating environment, configure services, and test sensor operation. Not bad! In Part 2, we are going to round out your VOXL 2 knowledge with an introduction to Modal Pipe Architecture (MPA), connecting to external devices and networks, and integrating cameras and external flight controllers.

As a reminder, this tutorial is a summary of our Monthly Drone Software Meetup, from the VOXL 2 Essentials edition, featuring Andrew Wilkins, Co-Founder, Ascend Engineering. Be sure to keep the official VOXL 2 documentation open for reference.

Understanding MPA Pipelines

To understand MPA, ModalAI’s custom pipeline architecture, the key is the word pipeline. You may have heard the word POSIX in the context of pipelines, but forget that for now. Just remember that MPA handles the data flow from components and services to other components and services, just like a pipeline in the real world.

ModalAI made MPA custom to increase the efficiency of the data flows on a VOXL 2 board. It includes additional features like automatic connection management and direct memory access (DMA) support. This design allows for low-latency and high-throughput data processing, essential for real-time drone operations.

Each pipeline consists of a source (producer of data), a sink (consumer of data), and optionally, intermediate processors (which can modify or analyze the data as it flows through the pipeline). These components are connected via channels that facilitate the data flow.

Let’s take a look at what all that jargon means in practice. Start by using our old friend voxl-inspect-services. If the voxl-cpu-monitor service is not Enabled and Running, start it up with the knowledge you gained in Part 1. Then call ls /run/mpa/.

You will see cpu-monitor show up. That means our voxl-cpu-monitor services outputs the corresponding MPA pipeline as planned. If you want to test this, issue the command systemctl stop voxl-cpu-monitor then run ls /run/mpa/ again. NOTHING! Run systemctl start voxl-cpu monitor to restart the service, and run ls /run/mpa/ one more time to see that our MPA pipeline, cpu-monitor has happily returned😁.

This adds a wrinkle to our understanding of the operating environment. Instead of querying the CPU directly, when enabled and requested, MPA creates a pipeline for CPU data to stream through, allowing other services and components to ingest it. To take a look at the data the CPU is outputting through the MPA pipeline, call voxl-inspect-cpu.

What’s amazing about this is multiple services can call on the same data stream, and MPA creates a new pipeline to meet the request. Look what happens now when we cd into /run/mpa/cpumonitor and run ls.

Next to ‘info’, you can see an ID string appended to the end of voxl-inspect-cpu, identifying that pipeline. If you had multiple instances running, you would see each of them listed here with unique IDs.

If you want to check out some more MPA pipeline examples, check out this GitLab repo authored by James Strawson.

Connecting to External Devices and Networks

Unless you plan on flying your drone while tethered to your laptop, it’s probably time to look for other methods of connecting. The VOXL 2 features a range of connectivity options, including serial ports and UART, Wi-Fi, SDR, radio, Bluetooth, and even Ethernet.

For ease of use, we’re going to choose Wi-Fi for this tutorial. To complete this part you’ll need a USB3 Expander board (ModalAI), USB3 JST (ModalAI), and WiFi USB Module (ModalAI / Amazon). If you’ve already figured out how to connect to the VOXL 2 remotely, please skip ahead to learn how to integrate cameras and other external devices.

This hat connects directly on top of the VOXL 2, after which you should be ready to connect.

Issue the command voxl-wifi to get started. To connect your laptop directly to your drone select Operation Option 3) softap. In our example, we name the SSID godfrey-drone and very very securely leave the password as the default (not recommended). Once you complete that step then look for the new network SSID on your laptop and sign in with the password you created.

Now, you can ssh into the drone using the command ssh root@192.168.8.1 at the default IP. The password is ‘oelinux123’.

Integrating Sensors and External Flight Controllers

The VOXL 2 offers many routes for integrating external devices including other flight controllers. A non-exhaustive list includes items like cameras, thermal sensors, 5G transmitters, Lidar, and PX4-based flight controllers.

We are going to dive into connecting an external flight controller in more detail. Much of what you will learn here can be applied to other sensors. For this part of the tutorial you will need the following:

  • USB3 Expander board (ModalAI)

  • UART Cable (ModalAI or online)

  • External FC (wherever)

    • Including Ardupilot

    • MAVLink

Connect all those pieces, and you should have a testing setup that looks something like this. 

Let’s use our friend voxl-inspect-services to see where we are at.

Now, we are going to run voxl-configure-mavlink-server, and select 1) yes to reset to factory defaults then also 1) yes to allow communication with an external PX4 flight controller.

Once you receive notice that the voxl-mavlink-server is done, run vim /etc/mo^C and cd into /etc/modalai/. This folder contains config files for a many of the VOXL 2 services for you to modify to meet your needs. We are going to pop open the MAVLink server config file by running vim voxl-mavlink-server.config. Scroll all the way down past the commented text to the section with brackets, where we can start modifying parameters. 

Set en_external_uart_ap to true, and change autopilot_uart_baudrate to 57600. Run :wq (Write and Quit) to save your changes.

What do we do now? That’s right, we run voxl-inspect-services to see what has changed. voxl-mavlink-server should be Enabled, but it’s not Running yet, so we issue a systemctl start voxl-mavlink-server to get that going. Then we are going to connect to the VOXL over WiFi.

Finally, we are going to open QGroundControl to see that we can actually view the MAVLink packets that are coming in. 

And there ya go! In summary, now the VOXL 2 is reading MAVLink packets on the external flight controller, and then it’s relaying them over WiFi to our laptop.

Working with the Internal PX4 Systems

If you want to tap into the more advanced applications for the VOXL 2 like obstacle avoidance, realtime data processing, etc., you first need to nail down your hardware. The VOXL 2 comes with a pre-installed library of SKUs (drones) that you can select to get up and running fast. Run voxl-configure-sku to see what is available.

If you are building your own drone or have your own custom hardware, no worries. You can add your own SKU, but that’s outside of the scope of the tutorial today. We are going to run voxl-configure-sku -- wizard and select 17) voxl2-board-only.

It will then ask us what camera setup we want, and we will simply hit Enter to select the default and move along. Now we run voxl-configure-mpa which will run through and automatically Enable and Disable services that are needed for that SKU’s setup. Select y to continue, and if you look fast enough you can see everything that is executing.

You will then be asked to power cycle your VOXL. Once you are back up and running, it’s time to run voxl-inspect-services once again to see where we stand.

You will notice voxl-portal is Enabled and Running. VOXL Web Portal runs a web page-style dashboard at 192.168.8.1 that you can use to where you get can gain insights into everything that’s happening on the VOXL.

If you have trouble discerning what sensor numbers racing by actually mean (like any normal person would), this dashboard displays data in a digestible manner ideal for testing and debugging. 

Lastly, we can connect to QGroundControl like we would with any other drone.

Camera Integration

Within the operating environment type in volx-configure-cameras and hit Enter. We will select Hires(imx214) Only. Run volx-configure-cameras 8 to do so.

Enter back into adb shell, and you guessed it, run voxl-inspect-services. You will see that the voxl-camera-server is Enabled and Running. Run voxl-portal manually to take a look at what the camera is doing. Select Cameras>Hires Large Color, and watch some magic happen.

Okay, that’s cool (and never mind that Andrew is holding the camera upside down), but most people want video streamed via RTSP. Run voxl-streamer -h. There you can see a -i --input-pipe flag that can take an override with a specific config file. Let’s type in voxl-streamer -i hires_small_color and run it. We should receive an RTSP address. In our example it is rtsp://127.0.0.1:8900/live. You can view this in QGC or in VLC.

Conclusion

This guide has provided a comprehensive overview of leveraging the VOXL 2 platform for advanced drone development, focusing on connecting to and configuring the operating environment, understanding and utilizing the Modal Pipe Architecture (MPA) for efficient data flow, and integrating external cameras and flight controllers. That’s quite a lot. You now have everything you need to know to get started with VOXL 2 development. Congrats!