Main Content

predictMapToTime

Predict dynamic map to a time stamp

Since R2021a

Description

map = predictMapToTime(tracker,time) returns the map of the tracker predicted to the specified time.

Note

This function only outputs the predicted map and does not change the results when calling the tracker. Use these three tunable properties (FreeSpaceDiscountFactor, DeathRate, and ProcessNoise) of the tracker to control how uncertainties impact the prediction of the map.

example

___ = predictMapToTime(___,'WithStateAndCovariance',tf) additionally specifies whether the function predicts the state and state covariance of the map. If tf is specified as false, only the evidences and occupancy of the map is predicted. The state, state covariance, and classification of a cell as static or dynamic are not predicted. Specifying tf as false allows you to predict the occupancy of the environment faster.

example

Examples

collapse all

Create a tracking scenario.

rng(2021);% For reproducible results
scene = trackingScenario('UpdateRate',5,'StopTime',15);

Add a platform. Mount a lidar sensor on the platform.

plat = platform(scene);
lidar = monostaticLidarSensor(1,'DetectionCoordinates','Body');

Add two targets and define their position, velocity, orientation, dimension, and meshes.

for i = 1:2
    target = platform(scene);
    xStart = 50*(2*rand-1);
    xFinal = 50*(2*rand-1);
    yStart = 50*(2*rand-1);
    yFinal = 50*(2*rand-1);
    target.Trajectory = waypointTrajectory([xStart yStart 0;xFinal yFinal 0],[0 15]);
    target.Mesh = extendedObjectMesh('sphere');
    target.Dimensions = struct('Length',4, ...
        'Width',4, ...
        'Height',2, ...
        'OriginOffset',[0 0 0]);
end

Define the configuration of the sensor.

config = trackingSensorConfiguration(1, ...
    'SensorLimits',[-180 180;0 100], ...
    'SensorTransformParameters',struct, ...
    'IsValidTime',true);

Create a grid-based tracker.

tracker = trackerGridRFS('SensorConfigurations',config, ...
    'AssignmentThreshold',5, ...
    'MinNumCellsPerCluster',4, ...
    'ClusteringThreshold',3);

Advance scenario and run the tracker based on the lidar data.

while advance(scene)
    time = scene.SimulationTime;
    % Generate point cloud
    tgtMeshes = targetMeshes(plat);
    [ptCloud,config] = lidar(tgtMeshes,time);

    % Format the data for the tracker
    sensorData = struct('Time',time, ...
        'SensorIndex',1, ...
        'Measurement',ptCloud', ...
        'MeasurementParameters',struct ...
        );

    % Call tracker using sensorData to obtain the map in addition
    % to tracks
    [tracks,~,~,map] = tracker(sensorData,time);
end

Show the final map.

figure
show(map)

Figure contains an axes object. The axes object contains 2 objects of type image, surface.

Make a few assumptions before predicting the map.

% Assume free space remains free during prediction
f = tracker.FreeSpaceDiscountFactor;
tracker.FreeSpaceDiscountFactor = 1;

% Assume no targets die during prediction
d = tracker.DeathRate;
tracker.DeathRate = 0;

% Assume no process noise during prediction
q = tracker.ProcessNoise;
tracker.ProcessNoise = zeros(size(q));

Predict the map 1 second forward and show the predicted map.

figure
predictedMap = predictMapToTime(tracker,16)
predictedMap = 
  dynamicEvidentialGridMap with properties:

    NumStateVariables: 4
          MotionModel: 'constant-velocity'
           GridLength: 100
            GridWidth: 100
       GridResolution: 1
    GridOriginInLocal: [-50 -50]

show(predictedMap)

Figure contains an axes object. The axes object contains 2 objects of type image, surface.

Restore property values for the tracker.

tracker.FreeSpaceDiscountFactor = f;
tracker.DeathRate = d;
tracker.ProcessNoise = q;

Input Arguments

collapse all

Grid-based RFS tracker, specified as a trackerGridRFS object.

Prediction time, specified as a positive scalar. The dynamic map of the tracker is predicted to this time. The time must be greater than the time input to the tracker in the previous track update. Units are in seconds.

Example: 1.0

Data Types: single | double

Enable state and state covariance prediction, specified as true or false. Specifying it as false allows you to predict the occupancy of the environment faster.

Data Types: logical

Output Arguments

collapse all

Map after prediction, returned as a dynamicEvidentialGridMap object.

Version History

Introduced in R2021a