主要内容

MDF File Logging on PX4 Autopilots

R2026b

MDF (Measurement Data Format) is a standardized binary format (.mf4) widely used in automotive and aerospace industries for logging large, time-synchronized datasets. When deployed on PX4® autopilots, MDF file logging enables you to record internal Simulink® signals directly to the SD card on the flight controller without requiring a host connection.

MDF file logging is the recommended approach for logging custom Simulink signals on PX4 hardware due to its low complexity and broad tool support.

Key Features

  • Industry Standard — MDF4 is an open, well-defined format (ASAM MDF) with broad adoption across automotive and aerospace measurement tools.

  • Optimized for Embedded Targets — Designed for sequential, high-speed logging on microcontrollers with minimal CPU overhead.

  • Rich Metadata — Supports signal names, units, data types, and time synchronization information within the file.

  • Tool Compatibility — Logged .mf4 files can be opened directly in Simulation Data Inspector (SDI), Vehicle Network Toolbox, and third-party MDF viewers.

  • No Host Connection Required — Data is logged to the onboard SD card and can be retrieved after the flight.

Enable MDF File Logging

To enable MDF file logging for your Simulink model deployed on a PX4 autopilot:

  1. In your Simulink model, mark the signals you want to log by selecting them and enabling data logging.

  2. Open Configuration Parameters and navigate to Code Generation > Interface.

  3. In the Data exchange interface section, select the Log signals to MDF file checkbox.

    Log signals to MDF file option.

  4. Build and deploy the model to the PX4 autopilot.

  5. After the flight, retrieve the .mf4 file from the SD card.

View Logged Data

After retrieving the .mf4 file from the SD card, you can analyze the logged data using:

  • Simulation Data Inspector (SDI) — Import the .mf4 file directly into SDI to visualize and compare signals. For more information, see Import Data from Workspace or File into Simulation Data Inspector (Simulink).

  • Vehicle Network Toolbox — Use MDF file reading functions to programmatically access and process the logged data in MATLAB. For more information, see MDF Files (Vehicle Network Toolbox)MDF Files (Vehicle Network Toolbox)

See Also

Topics