UAVCAN HITL UAV Simulator for PX4
Hi from RaccoonLab, a team of enthusiasts in field robotics! We want to share our true-HITL UAVCAN-based simulator for PX4. Quick demo:
This post is based on our PX4 Developer Summit 2021 lighting talk.
We believe a unified UAVCAN bus for drone onboard electronics will become a mainstream approach shortly. Our simulator is already based on UAVCAN (in opposition to UART-MAVLINK) and emulates exactly the same messages as real UAVCAN-sensors.
The project is part of our team's efforts to create reliable control systems and applications in the field of aerial robotics.
![RaccoonLab RaccoonLab](https://webcf.waybackmachine.org/web/20211006151610/https://habrastorage.org/getpro/habr/upload_files/848/317/a3d/848317a3d107a5d51b37875daac020b3.jpeg)
Our team is called RaccoonLab, it's an acronym for robotics and control and also because coons are funny.
Motivation
![Motivation Motivation](https://webcf.waybackmachine.org/web/20211006151610/https://habrastorage.org/getpro/habr/upload_files/c7e/b1e/26e/c7eb1e26ee3bf99094c8f46e7d09da7a.jpeg)
The project itself is focused on a proof-of-concept of a new approach for HITL simulation. But it has a wider scope and its motivation is connected with the new UAVCAN-bus-oriented architecture of onboard electronics. We believe a unified digital bus for onboard drone electronics will be the dominant approach shortly. After all, cars already have an onboard CAN bus. Why do drones have to be behind?
![Motivation Motivation](https://webcf.waybackmachine.org/web/20211006151610/https://habrastorage.org/getpro/habr/upload_files/35a/c7d/eab/35ac7deab1826dec82c5d3fa6b090a1a.jpeg)
Let's imagine, we want to develop a highly reliable onboard control system for an air taxi or last-mile drone delivery based on the PX4 ecosystem.
I'm sure, in such a case, we'll need distributed architectures to provide fault tolerance and reliability. Also, we need tools to test our control system in the configuration as close as possible to the final flight configuration.
Problem
![Problem Problem](https://webcf.waybackmachine.org/web/20211006151610/https://habrastorage.org/getpro/habr/upload_files/23f/1cd/917/23f1cd9179b6de6ea9f69b5d85d07d8c.jpeg)
We address the problem, that the current MAVLINK-HITL approach has a list of drawbacks:
autopilot software configuration differs considerably from flight configuration, and it does matter;
digital onboard bus and emulation at the device at a protocol level are not supported;
also, we found, UAV dynamics itself needs more attention for more physically accurate simulation.
Solution
![Solution Solution](https://webcf.waybackmachine.org/web/20211006151610/https://habrastorage.org/getpro/habr/upload_files/23a/08b/2a7/23a08b2a799d432fcd460ddf1091bfe4.jpeg)
https://github.com/InnopolisAero/innopolis_vtol_dynamics
Here is our solution. We created a communication package to simulate UAVCAN sensors at the protocol level. We simulated accurate UAV dynamics of the VTOL plane and quadcopter. Autopilot couldn't even differ HITL simulation and real flight mode. We also integrated with Innopolis 3d simulator for high-level perception system simulation and visualization.
Dynamics
![Dynamics Dynamics](https://webcf.waybackmachine.org/web/20211006151610/https://habrastorage.org/getpro/habr/upload_files/4a2/7e3/ee2/4a27e3ee21d57ef88f47b14f9be7b5c6.jpeg)
VTOL plane simulation is based on full rigid body dynamics. Aerodynamics simulation is based on CFD study. And actuators models are obtained on a special test bench.
Profit
This simulator already works as a proof-of-concept and is freely available on Github.
We are proud, that our simulator already was used to find the bug of airspeed sensor filtration code and test fixes. It's proof of the value it could give to developers.
![Profit Profit](https://webcf.waybackmachine.org/web/20211006151610/https://habrastorage.org/getpro/habr/upload_files/39c/305/d4a/39c305d4a46f22ec5ecab065ce24a403.png)
Welcome
We hope, we'll find adopters and contributors among PX4 developers, testers, and researchers.
Let's make UAVCAN HITL a new standard for PX4!
Thank you for your attention and welcome to our Github repo and RaccoonLab's social networks.