Main Content

flightLogSignalMapping

Visualize UAV flight logs

Description

The flightLogSignalMapping object maps flight log messages to signals that you can use to visualize the messages.

To inspect UAV logs, first load your log file using mavlinktlog, ardupilotreader or ulogreader. Use the preconfigured signal mapping, or map your own signal using mapSignal or mapulog. Then, use show to display the list of configured plots.

For ease of use, see the provided Predefined Signals and Predefined Plots. You can also view the details of the signals and plots of a flightLogSignalMapping object by using the info object function.

Creation

Description

mapper = flightLogSignalMapping creates a flight log signal mapping object with no preset signal mapping. Before you can visualize signals, map signals using mapSignal.

mapper = flightLogSignalMapping("tlog") creates a flight log signal mapping object for the imported MAVLink TLOG message tables.

mapper = flightLogSignalMapping("ulog") creates a flight log signal mapping object for imported PX4® ULOG files. By default, the object maps messages to the predefined signals using PX4 1.14 log. Use the mapulog function to map log messages from different PX4 versions.

example

mapper = flightLogSignalMapping("bin") creates a flight log signal mapping object for imported ArduPilot log BIN file.

Properties

expand all

Names of all mapped signals, specified as a string array.

Example: ["Accel" "Gyro" "Mag" "Barometer" "Gyro2"]

Data Types: string

Names of plots that are available based on the mapped signals, specified as a string array. To add plots to this list, either map signals for the Predefined Plots or call updatePlot.

Example: ["Accel" "Gyro" "Mag" "Barometer" "Gyro2"]

Data Types: string

Object Functions

checkSignalCheck mapped signal
copyCreate deep copy of flight log signal mapping object
extractExtract UAV flight log signals as timetables
infoSignal mapping and plot information for UAV log signal mapping
mapSignalMap UAV flight log signal
mapulogMap PX4 ULOG messages to signals
showDisplay plots for inspection of UAV logs
updatePlotUpdate UAV flight log plot functions

Examples

collapse all

Download the magFailLog.ulg flight log file from MathWorks website. This sample flight log is available from the PX4® Flight Review website [1].

magFailLog = matlab.internal.examples.downloadSupportFile("uav","data/magFailLog.ulg");

Read the flight log.

data = ulogreader(magFailLog);

Create a flight log signal mapping object.

mapper = flightLogSignalMapping('ulog');

Plot the EKF heading innovations and its variance using the predefined plot. The plot shows that after 200 seconds, the heading innovation starts to increase, which indicates a less precise heading estimate.

show(mapper,data,PlotsToShow="HeadingInnovations")
grid on

Figure HeadingInnovations contains an object of type stackedplot. The chart of type stackedplot has title HeadingInnovations.

Extract the EKF heading innovations signal as a timetable.

innovationsHeading = extract(mapper, data, "EstimatorInnovationHeading");

Extract the EKF magnetometer status signal as a timetable.

magStatusFlags = extract(mapper, data, "EstimatorStatusFlagMagnetometer");

Combine the EKF heading innovations and magnetometer status timetables.

combinedData1 = synchronize(magStatusFlags{1}, ... 
    innovationsHeading{1}, "union", "nearest");

Plot the heading innovation and the RejectYaw fields.

The plot indicates that the EKF rejects the heading estimate when the heading innovation is outside the range of -1 to 1, which mostly happens after 200 seconds.

stackedplot(combinedData1(:,["Heading", "RejectYaw"]), ...
DisplayLabels=["Heading Innovation","RejectYaw"])
grid on

Figure HeadingInnovations contains an object of type stackedplot.

To analyze the possible cause of the heading estimate failure, extract the EKF magnetometer innovations signal as a timetable.

innovationsMagnetometer = extract(mapper,data,"EstimatorInnovationMagnetometer");

Extract the magnetometer reading from the IMU Sensor.

magnetometerReading = extract(mapper,data,"Mag");

Combine the EKF magnetometer innovations and magnetometer status timetables.

combinedData2 = synchronize(magStatusFlags{1},innovationsMagnetometer{1},magnetometerReading{1},"union", "nearest");

Plot the magnetometer reading, magnetometer innovations, and RejectYaw fields.

The plots indicate that the EKF rejects the yaw estimate when at least one axis of the magnetometer has a innovation that is outside the range of -0.1 to 0.1. This indicates that the heading estimation failure is likely caused by compass that is faulty or not properly calibrated.

stackedplot(combinedData2(:,["MagX","MagY","MagZ","X","Y","Z","RejectYaw"]), ...
DisplayLabels=["MagX","MagY","MagZ","MagX Innovation","MagY Innovation", ...
"MagZ Innovation","RejectYaw"])
grid on

Figure HeadingInnovations contains an object of type stackedplot.

More About

expand all

Version History

Introduced in R2020b

expand all

See Also