Main Content

read

Read recorded data

Since R2020a

Description

example

[simTime,poses,coverageConfigs,detections,sensorConfigs,sensorPlatformIDs,emissions,emitterConfigs,emitterPlatformIDs] = read(TSR) returns one recorded dataset at the simulation time, simTime, from a tracking scenario recording TSR.

Examples

collapse all

Load recorded data from a prerecorded scenario called recordedScenario. Construct a trackingScenarioRecording object using the recorded data.

load recordedData
recording = trackingScenarioRecording(recordedData);

Construct a theater plot to display the recorded data using multiple plotters.

tp = theaterPlot('AxesUnits', ["km" "km" "km"], 'XLimits',[-50 50]*1e3,...
    'YLimits',[-50 50]*1e3,'ZLimits', [-20 20]*1e3);
to = platformPlotter(tp,'DisplayName','Tower','Marker','d');
pp = platformPlotter(tp,'DisplayName','Targets');
dp = detectionPlotter(tp,'DisplayName','Detections','MarkerFaceColor','black');
cp = coveragePlotter(tp,'DisplayName','Radar Beam');

coverage = struct('Index',1,'LookAngle',[0;-7],'FieldOfView',[1;10],...
    'ScanLimits',[0 365;-12 -2],'Range',100e3,'Position',[0;0;-15],...
    'Orientation',eye(3));

Run the recorded scenario and animate the results.

scanBuffer = {};
while ~isDone(recording)
    % Step the reader to read the next frame of data
    [simTime,poses,covcon,dets,senconfig] = read(recording);
    scanBuffer = [scanBuffer;dets]; %#ok<AGROW>
    plotPlatform(to,poses(1).Position);
    plotPlatform(pp,reshape([poses(2:4).Position]',3,[])');
    plotCoverage(cp,covcon);
    if ~isempty(dets)
        plotDetection(dp,cell2mat(cellfun(@(c) c.Measurement(:)', scanBuffer, 'UniformOutput', false)));
    end
    
    % Clear the buffer when a 360 degree scan is complete
    if senconfig.IsScanDone
        scanBuffer = {};
        dp.clearData;
    end
end

Reset the recording to its beginning.

reset(recording)

Input Arguments

collapse all

Tracking scenario recording, specified as a trackingScenarioRecording object.

Output Arguments

collapse all

Simulation time, returned as a nonnegative scalar.

Poses of platforms, returned as an array of structures. The fields of each structure are:

FieldDescription
PlatformID

Unique identifier for the platform, specified as a positive integer. This is a required field with no default value.

ClassID

User-defined integer used to classify the type of target, specified as a nonnegative integer. Zero is reserved for unclassified platform types and is the default value.

Position

Position of platform in scenario coordinates, specified as a real-valued 1-by-3 row vector.

  • If the coordinateSystem argument is specified as 'Cartesian', the Position is the 3-element Cartesian position coordinates in meters.

  • If the coordinateSystem argument is specified as 'Geodetic', the Position is the 3-element geodetic coordinates: latitude in degrees, longitude in degrees, and altitude in meters.

Velocity

Velocity of platform in scenario coordinates, specified as a real-valued 1-by-3 row vector. Units are meters per second. The default value is [0 0 0].

Acceleration

Acceleration of the platform in scenario coordinates, specified as a 1-by-3 row vector in meters per second squared. The default value is [0 0 0].

Orientation

Orientation of the platform with respect to the local scenario navigation frame, specified as a scalar quaternion or a 3-by-3 rotation matrix. Orientation defines the frame rotation from the local navigation coordinate system to the current platform body coordinate system. Units are dimensionless. The default value is quaternion(1,0,0,0) or a 3-by-3 identity matrix.

AngularVelocity

Angular velocity of the platform in scenario coordinates, specified as a real-valued 1-by-3 vector. The magnitude of the vector defines the angular speed. The direction defines the axis of clockwise rotation. Units are degrees per second. The default value is [0 0 0].

Sensor coverage configurations, returned as an array of structures. The fields of each structure are:

Fields of configurations

FieldDescription
Index A unique integer to identify sensors or emitters.
LookAngle

Current boresight angles of the sensor or emitter, specified as:

  • A scalar in degrees if scanning only in the azimuth direction.

  • A two-element vector [azimuth; elevation] in degrees if scanning in both the azimuth and elevation directions.

FieldOfViewField of view of the sensor or emitter, specified as a two-element vector [azimuth; elevation] in degrees.
ScanLimits

Minimum and maximum angles the sensor or emitter can scan from its Orientation.

  • If the sensor or emitter can only scan in the azimuth direction, specify the limits as a 1-by-2 row vector [minAz, maxAz] in degrees.

  • If the sensor or emitter can also scan in the elevation direction, specify the limits as a 2-by-2 matrix [minAz, maxAz; minEl, maxEl] in degrees.

RangeRange of the beam and coverage area of the sensor or emitter in meters.
PositionOrigin position of the sensor or emitter, specified as a three-element vector [X, Y, Z].
OrientationRotation transformation from the scenario or global frame to the sensor or emitter mounting frame, specified as a rotation matrix, a quaternion, or three Euler angles in ZYX sequence.

Detections, returned as a cell array of objectDetection objects.

Sensor configurations, returned as an array of structures. The fields of each structure are:

FieldDescription
SensorIndex

Unique sensor index, returned as a positive integer.

IsValidTime

Valid detection time, returned as true or false. IsValidTime is false when detection updates are requested between update intervals specified by the update rate.

IsScanDone

IsScanDone is true when the sensor has completed a scan.

RangeLimitsLower and upper range detection limits, returned as a two-element real-valued vector in meters.
RangeRateLimitsLower and upper range-rate detection limits, returned as a two-element real-valued vector in m/s.
FieldOfView

Field of view of the sensor, returned as a 2-by-1 vector of positive real values, [azfov;elfov]. azfov and elfov represent the field of view in azimuth and elevation, respectively.

MeasurementParameters

Sensor measurement parameters, returned as an array of structures containing the coordinate frame transforms needed to transform positions and velocities in the top-level frame to the current sensor looking-angle frame.

Platform IDs of sensors, returned as an array of nonnegative integers.

Emissions, returned as a cell array of radarEmission or sonarEmission objects.

Emitter configurations, returned as an array of structures. The fields of each structure are:

FieldDescription
EmitterIndex

Unique emitter index, returned as a positive integer.

IsValidTime

Valid emission time, returned as 0 or 1. IsValidTime is 0 when emitter updates are requested at times that are between update intervals specified by the UpdateInterval property.

IsScanDone

Whether the emitter has completed a scan, returned as true or false.

FieldOfView

Field of view of the emitter, returned as a two-element vector [azimuth; elevation] in degrees.

MeasurementParameters

Emitter measurement parameters, returned as an array of structures containing the coordinate frame transforms needed to transform positions and velocities in the top-level frame to the current emitter looking-angle frame.

Platform IDs of emitters, returned as an array of nonnegative integers.

Version History

Introduced in R2020a