I’ve been working on an embedded flight software integration project connecting NASA’s Core Flight System (cFS) with PX4 Autopilot in a simulated quadcopter environment using Gazebo and QGroundControl.
I wanted to see how cFS can integrate into a flight system with telemetry monitoring, command sequencing, and fault-injection testing. In the demo below, you can see the quadcopter executing an autonomous flight mission and PX4’s failsafe response when GPS failure is injected through cFS.
What it does:
• A cFS app parses MAVLink from PX4 and publishes telemetry on the software bus
• PX4 status messages appear as cFS events
• A stored command sequence (SC) starts the flight plan loaded in QGC
• A Python dashboard displays live telemetry from cFS and PX4
This project has been a great opportunity to gain hands-on experience with flight software architecture, MAVLink communication, and simulation-based testing.
I’d appreciate any advice or feedback from flight software engineers, especially those with experience in PX4 or NASA cFS! Feel free to check out the repository, clone it, and experiment with it.
This is awesome Cody! Injecting a GPS failure through cFS Stored Commands and watching PX4’s failsafe respond is a really clever way to show flight software and autopilot working together. I’m a big fan of this project and will be trying it out . Great work!
Welcome to the PX4 community, and congratulations on the cFS–PX4 integration.
I had a look at your GitHub repository. The separation between cFS command sequencing and PX4’s flight-control and failsafe responsibilities is particularly interesting.
One direction that could make this demonstrator even more valuable is to turn the GPS fault-injection scenario into a reproducible, evidence-based validation case.
For example, it would be useful to capture a correlated sequence of:
The cFS Stored Command execution and fault-injection timestamp.
The first observable change in PX4’s GPS or estimator state.
Any relevant navigation-state or failsafe transition.
The subsequent vehicle response in simulation.
The recovery sequence after GPS restoration.
The important distinction is between observing that a failsafe eventually occurred and demonstrating when the first divergence appeared, how the response evolved, and whether the observed behaviour matched a defined expectation.
A useful next step might be a small validation matrix covering nominal operation, GPS loss, delayed restoration and repeated fault injection, with the same evidence captured for every run.
At PAMILANGA LTD, we are working on evidence and assurance methodologies for autonomous systems, so this is an area of particular interest to us.
Have you already considered exporting a common timestamped trace across cFS events, MAVLink messages and PX4 logs?
I’d be interested to hear how you plan to develop the fault-injection testing further.
Hello, thank you so much for the welcome and support! I got a chance to implement a fault analysis tool that parses the cFS log files and PX4 log files and compiles it into a sequence of events for the GPS fault and restore commands sent from cFS.
I’ll link a PDF with explanations and some data I collected from the tool.
Essentially the idea is to treat PX4 as the source of truth and use cFS only to inject the fault and observe PX4’s reaction. cFS sends the GPS fail and restore commands, mavlink_app turns the MAVLink telemetry it gets back into cFS events (each tagged with PX4’s boot time), and cFS Data Storage records them. After a flight, the tool merges those events with PX4’s own flight log on PX4’s clock, which gives one ordered sequence from the fault through PX4’s failsafe response to recovery.
I’d welcome any feedback, especially on the method for lining up the two clocks, and on whether other signals would be worth capturing. The PDF has the full tables and the explanation of the approach.
Thanks for sharing the fault-analysis update. Combining cFS events and PX4 ULog data into a single ordered timeline is a useful step toward reproducible fault analysis.
I particularly agree with treating PX4 as the authoritative source for its own vehicle state and failsafe behavior.
One point I would suggest making explicit is the distinction between three timestamps:
When cFS issues the GPS fault or restore command.
When PX4 first observes and reacts to the resulting condition.
When cFS receives and records the corresponding PX4 telemetry.
Even when events carry PX4 boot-time values, transport and processing delays can affect what those timestamps actually represent.
It may be valuable to document the timestamp origin for each event and test the merged timeline under controlled telemetry delays, dropped messages and a PX4 reboot.
For the next validation pass, I would also capture the estimator’s GPS-aiding status, navigation-state transitions, failsafe indicators and recovery conditions where available.
These checks could help distinguish the injected fault, the first observable estimator divergence, the first relevant vehicle-state change and the eventual recovery.
I’d be interested in reviewing a small reproducible event trace once the timing assumptions are documented.
No rush at all. It’s great to see NASA cFS being integrated with PX4.
I’ll be interested to see the results once you’ve implemented the changes. If you encounter any issues during testing or integration, I’d be happy to help investigate.