Contenuto principale

getLogFilesFromPX4Autopilot

R2026b

Retrieve MDF log files from SD card on PX4 autopilot

Since R2026b

    Description

    Add-On Required: This feature requires the UAV Toolbox Support Package for PX4 Autopilots add-on.

    getLogFilesFromPX4Autopilot(modelname) retrieves the most recent MDF log file corresponding to the specified model name from the SD card on the PX4 autopilot hardware board, using MAVLink FTP.

    example

    getLogFilesFromPX4Autopilot(modelname,Name,Value) retrieves MDF log files from the SD card based on the options that one or more Name,Value pair arguments specify.

    example

    Examples

    collapse all

    Retrieve the most recent MDF log file from the SD card on the PX4 autopilot.

    Consider that the file name of the Simulink® model configured for MDF file logging is px4_flight_controller. This model is deployed to the PX4 autopilot hardware three times, and you want to retrieve only the most recent MDF file.

    To retrieve the file, enter the following command at the MATLAB® command prompt after the model has successfully run on the hardware:

    getLogFilesFromPX4Autopilot("px4_flight_controller")

    The function copies only the most recent MDF file to the current folder in MATLAB.

    Retrieve MDF log files by specifying options as name-value pairs.

    Consider that the file name of the Simulink model configured for MDF file logging is px4_flight_controller. This model is deployed to the PX4 autopilot hardware three times, and you want to retrieve all files from all successful runs and delete them from the SD card after retrieval.

    To retrieve and delete the files, enter the following command at the MATLAB command prompt:

    getLogFilesFromPX4Autopilot("px4_flight_controller",ExtractFilesFromAllRuns=true,DeleteAfterRetrieval=true)

    The function copies all MDF files from all successful runs to the current folder in MATLAB and deletes them from the SD card.

    Input Arguments

    collapse all

    File name of the Simulink model configured for MDF file logging and deployed on the PX4 autopilot hardware board with an SD card inserted.

    Data Types: char | string

    Name-Value Arguments

    collapse all

    Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

    Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

    Example:

    Extract all MDF log files from the SD card on the PX4 autopilot hardware for all runs (all successful Build, Deploy & Start actions).

    Example: getLogFilesFromPX4Autopilot("px4_flight_controller",ExtractFilesFromAllRuns=true)

    Data Types: logical

    Delete the MDF log files from the SD card on the PX4 autopilot hardware after successful retrieval.

    Tip

    Set DeleteAfterRetrieval to true to reduce the time required to retrieve MDF log files from the SD card in subsequent runs.

    Example: getLogFilesFromPX4Autopilot("px4_flight_controller",DeleteAfterRetrieval=true)

    Data Types: logical

    COM port of the host computer to which the PX4 autopilot hardware board is connected, specified as a character vector or string scalar.

    Note

    This name-value argument is typically used when you select PX4 Pixhawk Series as the hardware board. For other boards such as PX4 Pixhawk 1, the function determines the COM port automatically unless you specify it with this argument.

    Example: getLogFilesFromPX4Autopilot("px4_flight_controller",COMPort="COM15")

    Data Types: char | string

    More About

    collapse all

    Version History

    Introduced in R2026b