A companion computer is like a partner to the flight controller (e.g., ArduPilot or PX4) in an autonomous vehicle. It handles more complex tasks that improve the vehicle’s overall capabilities.
Usually, the flight controller is a tiny computer (like the STM32) that takes in raw sensor data, figures out the vehicle’s position and orientation, and then tells the servos and motors how to move to reach a specific position and orientation. This can include commands like “stay in one place” or “go to this specific location.”
However, these microcontrollers are quite limited when it comes to their computing power, memory, and storage. A typical flight controller might have a processor running at 100MHz, with 512 Kb of RAM and 2 Mb of storage space.
In contrast, a companion computer is usually much more powerful. It might have a multi-core processor that runs at 1GHz or faster, over 1 GB of RAM, and tens of gigabytes of storage space.
The companion computer gets data from the flight controller, often along with information from other attached sensors. It uses this data to calculate and send more advanced commands to the flight controller. For example, the companion computer could instruct the flight controller to fly the vehicle to the location of an object it spotted using a connected camera.
What can I do with a Companion Computer?
A companion computer boasts moderate computational power and offers a plethora of interfaces, including USB and Ethernet, for capturing and processing data from devices connected to these ports.
We can categorise these devices into two primary classes. First, there are payload devices, such as cameras and LIDAR sensors, responsible for data collection. Second, we have communication devices, like 4G modems and long-range Wi-Fi equipment, which enable long-range monitoring and control.
Some examples of use cases include:
- Long range control over 4G or Wi-Fi
- Image capture and geotagging
- Real time image processing
- SLAM and indoor navigation
Interfacing the Companion Computer with the Flight Controller
On the hardware side, UARTs are used to pass data between the companion computer and flight controller. Flight controllers often label these as Telemetry ports. At a minimum, they consist of two data lines (transmit and receive) and ground. Some may also provide flow control (RTS/CTS lines), but this is typically optional.
Boards such as the Pi-Connect assist with hardware interfacing by including power converters and the correct type of telemetry port.
MAVLink is the protocol used for reading telemetry and issuing commands for flight controllers using ArduPilot. The commands can include high-level commands such as takeoff and landing. roll/pitch/yaw/throttle (RC) commands can be issued.
MAVLink is available in a number of different language bindings. This includes Python (most common), C, C# and JavaScript. Some higher level libraries (such as dronekit, pymavlink and MAVProxy) can provide a simpler interface over the top of MAVLink.
For integration with ROS, there are specific setups available online.
Examples of Companion Computers
Companion computers are typically small, low powered devices. Examples of this include the Raspberry Pi, Odroid and NVIDIA boards such as the Jetson Nano and TX2.
Larger vehicles can use larger (and more powerful) companion computers such as the Intel NUCs.
Choosing a suitable companion computer can depend on the following factors:
- Size and weight
- Power consumption
- Interfaces (ports) for the specific payload or sensors wanting to be used
- Computational speed. This is important in SLAM or image processing applications where a powerful CPU and large amounts of RAM are required
- Software support. Some boards (such as the Raspberry Pi) have a large ecosystem of pre-built software applications and support forums