Main Content

mapSignal

Map UAV flight log signal

Since R2020b

Description

mapSignal(mapper,signalName,timeFunc,valueFunc) maps the signal with name signalName to a pair of function handles, timeFunc and valueFunc. These functions define the time stamps and values of signals from a flight log file, which can be imported using mavlinktlog or ulogreader. For a list of preconfigured signals and plots, see Predefined Signals and Predefined Plots.

mapSignal(mapper,signalName,timeFunc,valueFunc,varNames) maps the signal with name signalName and specifies the variable names, varName, for the columns of a matrix generated from valueFunc.

mapSignal(mapper,signalName,timeFunc,valueFunc,varNames,varUnits) maps the signal with name signalName and specifies the units, varUnits for varName.

Input Arguments

collapse all

Flight log signal mapping object, specified as a flightLogSignalMapping object.

Signal name to map data, specified as a string scalar or character vector.

Example: "Gyro"

Data Types: char | string

Timestamps for signal values , specified as a function handle. Typically, this function handle extracts time data from a flight log, which can be imported using mavlinktlog or ulogreader.

Example: @(x)x.Gyro.Time

Data Types: function_handle

Values for signal, specified as a function handle. Typically, this function handle extracts signal data from a flight log, which can be imported using mavlinktlog or ulogreader.

Example: @(x)x.Gyro.Value

Data Types: function_handle

Variable names for a matrix of values, specified as a string array or cell array of character vectors. Each element corresponds to a column in the matrix of values generated from valueFunc.

Example: ["xPos" "yPos" "zPos"]

Data Types: char | string

Variable units for a matrix of values, specified as a string array or cell array of character vectors. Each element corresponds to an element in varNames.

Example: ["m" "m" "rad"]

Data Types: char | string

More About

collapse all

Predefined Signals

A set of predefined signals and plots are configured in the flightLogSignalMapping object. Depending on your log file type, you can map specific signals to the provided signal names using mapSignal. You can also call info to view the table for your log type and see whether you have already mapped a signal to that plot type.

Specify the SignalName as the input to mapSignal. Signals with the format SignalName# support mapping multiple signals of the same type. Replace # with incremental integers for each signal name when calling mapSignal.

The predefined signals have specific names and required fields when mapping the signal.

Predefined Signals

Signal NameDescriptionFieldsUnits
Accel#Raw accelerometer reading from IMU sensor[ax ay az]m/s2
Airspeed#Airspeed reading of pressure differential, indicated air speed, and temperature[PressDiff, AirSpeed, Temp]Pa, m/s, ℃
AttitudeEulerAttitude of UAV in Euler (ZYX) form[Roll, Pitch, Yaw]radians
AttitudeRateAngular velocity along each body axis[xRotRate, yRotRate, zRotRate]rad/s
AttitudeTargetEulerTarget attitude of UAV in Euler (ZYX) form[TargetRoll, TargetPitch, TargetYaw]radians
Barometer#Barometer readings for absolute pressure, relative pressure, and temperature[PressAbs, PressAltitude, Temp]Pa, m, ℃
BatteryVoltage readings for battery and remaining battery capacity (%)[Volt1,Volt2, ... Volt16, RemainingCapacityV, %
GPS#GPS readings for latitude, longitude, altitude, ground speed, course angle, and number of satellites visible[lat, long, alt, groundspeed, courseAngle, satellites]degree, degree, m, m/s, degree, n/a
Gyro#Raw body angular velocity readings from IMU sensor[GyroX, GyroY, GyroZ]rad/s
LocalNEDLocal NED coordinates estimated by the UAV[xNED, yNED, zNED]meters
LocalNEDTargetTarget location in local NED coordinates[xTarget, yTarget, zTarget]meters
LocalNEDVelLocal NED velocity estimated by the UAV[vx vy vz]m/s
LocalNEDVelTargetTarget velocity in local NED coordinates[vxTarget, vyTarget, vzTarget]m/s
Mag#Raw magnetometer reading from IMU sensor[x y z]Gs

Predefined Plots

After mapping signals to the list of predefined signals using mapSignal, specific plots are made available when calling show. To view a list of available plots and their associated signals for your specific object, call info(mapper,"Plot"). If you want to define custom plots based on signals, use updatePlot.

Each predefined plot has a set of required signals that must be mapped.

Predefined Plots

PlotDescriptionSignals

Attitude

Attitude lot with roll, pitch, yaw, and body rotation rates versus time for a specific flight log

Stacked plot of roll, pitch, yaw angles and body rotation ratesAttitudeEuler, AttitudeRate, Gyro#

AttitudeControl

Roll, pitch, yaw, and corresponding target values versus time for a specific flight log

Estimated attitude of UAV and the attitude target set pointAttitudeEuler, AttitudeTargetEuler

Battery

Battery consumption plotBattery

Compass

Yaw, MagX, MagY, and MagZ plots versus time of a sample flight log plot

Estimated yaw and magnetometer readingsAttitudeEuler, Mag#, GPS#

GPS2D

Lat-long plot using a sample GPS trajectory as lines in a map

Raw Lat-Lon plot for GPS sensor readings.GPS#

Height

GPS and Barometer readings, and fused height plots versus time

Stacked plots of barometer reading, GPS altitude reading, and fused height estimateBarometer#, GPS#, LocalNED

Speed

Ground speed and air speed plots versus time

Stacked plot of ground velocity and air speedGPS#, Airspeed#

Trajectory

North East Up plot for a 3D trajectory in space

Trajectory in local coordinates versus target set pointsLocalNED, LocalNEDTarget

TrajectoryTracking

Difference between x, y, z versus time in a stacked plot

Error between desired and actual position in NED coordinatesLocalNED, LocalNEDTarget

TrajectoryVelTracking

Difference between vx, vy, vz versus time in a stacked plot

Error between desired and actual velocity in NED coordinatesLocalNEDVel, LocalNEDVelTarget

Version History

Introduced in R2020b