Can flight controllers and Mission Planner log a digital input or output?

Can flight controllers and Mission Planner be used to either:

  1. Read a digital input and log that digital input in Mission Planner ?
  2. Write a digital output and log that digital output in Mission Planner ?

I am instrumenting a drone with different sensors and data acquisition systems (DAQS). This means I will have datalogs of different formats from different sources of DAQS, including the datalog from the flight controller and Mission Planner.

These multiple datalogs will need to be synchronised somehow when they are reviewed offline.

I was thinking of using a digital pulse train from one of the DAQS so that I can sychronise all the logs. One of the DAQS will be the master and transmit and log the pulse train, the other DAQS will be slaves and log the pulse train from the master DAQ.

I am currently using Orange Cube and Pixhawk flight controllers.

You can log and transmit to MissionPlanner whatever you want with a LUA-Script.
So if you manage to read all your sensors via LUA, you could have everything directly in the flight log, no need to synchronize anything. Or you could just log the pulse with LUA and perform the synchronization manually. For that single digital input you could probably use the Button function: ardupilot/libraries/AP_Scripting/examples/button_test.lua at master · ArduPilot/ardupilot · GitHub

1 Like

Thanks Vabe, I am using specialist DAQS which are logging lots of specialist sensors, some of which are logging at very high rates.

It would not be possible to use these sensors with Mission Planner, so the logs have to be independent.

Therefore the syncing of these multiple logs will have to be done manually offline.

Can both the Orange cube and Pixhawk read this button function ? How do I find which connector and pin to use for the digital input ?

The latency of reading this digital input must be low, otherwise there will be a timing error when manually syncing all the logs together.

Never played with the button functionality myself, but both boards should support it: Buttons — Copter documentation

LUA-Scripts definitely work on the cube orange, for the pixhawk it depends on the version. With scripting I achieved roughly 250Hz, although there were some significant outliers (20ms instead of 4)

From the LUA script, it appears the digital input (for the button) is polled every 1 second. This would be too slow to accurately log and sync a digital pulse train.

It might be better that the flight controller sends and logs the pulse train via a digital output, is that possible ?

Or it might be better if the logging in the flight controller can be triggered externally ?

Yeah, but you can change the polling rate by changing the value in return update, ms. With that I achieved 250Hz, although with some inconsistencies.

This were my results when requesting an update rate of 1kHz, on the x-axis you have the time in seconds, on the y-axis how often it took that amount of seconds between two executions:
But be aware, that those test were performed on ground whilst disarmed if I remember correctly…