I’m experimenting with an embedded onboard neural net and is planned to be as simple as possible to start.
It is aimed at something like onboard intelligence for turbulence detection (for example) not GNC.
It is a very simple feed forward neural net, adapted to an embedded ArduPilot system, from Dave Miller’s general (PC based) neural net in C++: https://millermattson.com/dave/?p=54
So making modifications to dynamic memory, timing, training, loading weights, etc…embedded systems type constraints as best as possible.
This is part of a longer-term goal to develop an embedded-safe neural net architecture that can run efficiently within ArduPilot’s constraints - eventually.
Note:
I am just working a few hours a week on and off when I have time. Feel free to use it or take it in a completely different direction based on where the commits are at over time.
I am sure there are all sorts of companies with very advanced onboard ML but thought I would share this if anyone was interested and on the same page.
Link to code in progress:
There is an initial scaffold for the unit test.
The plan is to - expand the unit test for training the net on a dev machine with simulated data and then eventually past flight telemetry. The idea is that users (developers for now) can tailor the net to their application and/or need (maybe something like an addition to precision landing vs turbulence detection). After training, the the neural weights can be burned to flash and loaded on initialization onboard for the next flight, based on what it learned:
The new embedded ArduPilot neural‑net library is now successfully learning XOR inside SITL.
This confirms that the full forward‑pass, backprop, gradient flow, and weight‑update logic are working correctly in an embedded‑safe, fixed‑size implementation.
What’s needed next (for anyone who wants to continue the work)
Weight persistence
Add a mechanism to save trained weights from SITL and load them onboard during initialization.
The library already exposes the weight structures; this is mostly a matter of serialization and a small loader.
Scheduling inference
Once weights are loaded, the network becomes a fixed function.
Running feedForward() + getResults() at ~1 Hz is more than enough for initial testing.
Feeding real sensor data
Replace the XOR inputs with actual flight‑relevant features.
The input size and layer sizes can be adjusted in AP_Neural_Config.h.
Activation functions
The current implementation uses tanh, which is fine for the toy model.
For real turbulence or anomaly detection, experimenting with ReLU or leaky‑ReLU in the hidden layers would likely improve responsiveness to sharp sensor changes. It’s modular so you should be able to try without too much trouble.
Project Status
I’m moving on to another journey and won’t be continuing development myself, but the library is now in a solid, working state and ready for integration and onboard testing.
This work is based on Dave Miller’s original PC‑based neural net tutorial, adapted for ArduPilot’s embedded constraints, and co‑developed/reviewed with Microsoft Copilot.
Repository
Library directory and branch (everything is self‑contained):
Commits:
If anyone wants to take this further for turbulence detection or some type anomaly detection the foundation is now in place.