Main Content


Predict dynamic map to a time stamp



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


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


___ = 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.


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]);

Define the configuration of the sensor.

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

Create a grid-based tracker.

tracker = trackerGridRFS('SensorConfigurations',config, ...
    'AssignmentThreshold',5, ...
    'MinNumCellsPerCluster',4, ...

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);

Show the final map.


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.

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

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


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.

Introduced in R2021a