trackingScenario

Create tracking scenario

Description

trackingScenario creates a tracking scenario object. A tracking scenario simulates a 3-D arena containing multiple platforms. Platforms represent anything that you want to simulate, such as aircraft, ground vehicles, or ships. Some platforms carry sensors, such as radar, sonar, or infrared. Other platforms act as sources of signals or reflect signals. Platforms can also include stationary obstacles that can influence the motion of other platforms. Platforms can be modeled as points or cuboids by specifying the 'Dimension' property when calling platform. Platforms can have aspect-dependent properties including radar cross-section or sonar target strength. You can populate a tracking scenario by calling the platform method for each platform you want to add. Platforms are Platform objects. You can create trajectories for any platform using the kinematicTrajectory or waypointTrajectory System objects. After creating the scenario, run the simulation by calling the advance object function.

Creation

sc = trackingScenario creates an empty tracking scenario with default property values.

sc = trackingScenario(Name,Value) configures a trackingScenario object with properties using one or more Name,Value pair arguments. Name is a property name and Value is the corresponding value. Name must appear inside single quotes (''). You can specify several name-value pair arguments in any order as Name1,Value1,...,NameN,ValueN. Any unspecified properties take default values.

Properties

expand all

Stop time of simulation, specified as a positive scalar. A simulation stops when either of these conditions is met:

  • The stop time is reached.

  • Any platform reaches the end of its trajectory and you have specified the platform Motion property using waypoints, waypointTrajectory.

Units are in seconds.

Example: 60.0

Data Types: double

This property is read-only.

Current time of the simulation, defined as a positive scalar. To reset the simulation time to zero and restart the simulation, call the restart method. Units are in seconds.

Data Types: double

Frequency of simulation updates, specified as a positive scalar. This is the rate at which to provide successive updates of the scenario simulation. Units are in Hz.

Example: 2.0

Data Types: double

This property is read-only.

Run-state of simulation, defined as true or false. If the simulation is running, IsRunning is true. If the simulation has stopped, IsRunning is false. A simulation stops when either of these conditions is met:

  • The stop time is reached.

  • Any platform reaches the end of its trajectory, and you have specified that platform Motion strategy with waypoints using the waypointTrajectory System object™.

Units are in seconds.

Data Types: logical

This property is read-only.

Platforms in the scenario, returned as a cell or cell array of Platform objects. To add a platform to the scenario, use the platform object function.

Object Functions

advanceAdvance tracking scenario simulation by one time step
platformAdd platform to tracking scenario
platformPosesPositions, velocities, and orientations of all platforms in tracking scenario
platformProfilesProfiles of platforms in tracking scenario
restartRestart tracking scenario simulation
recordRun tracking scenario and record platform states

Examples

collapse all

Construct a tracking scenario with two platforms following different trajectories.

sc = trackingScenario('UpdateRate',100.0,'StopTime',1.2);

Create two platforms.

platfm1 = platform(sc);
platfm2 = platform(sc);

Platform 1 follows a circular path of radius 10 m for one second. This is accomplished by placing waypoints in a circular shape, ensuring that the first and last waypoint are the same.

wpts1 = [0 10 0; 10 0 0; 0 -10 0; -10 0 0; 0 10 0];
time1 = [0; 0.25; .5; .75; 1.0];
platfm1.Trajectory = waypointTrajectory(wpts1, time1);

Platform 2 follows a straight path for one second.

wpts2 = [-8 -8 0; 10 10 0];
time2 = [0; 1.0];
platfm2.Trajectory = waypointTrajectory(wpts2,time2);

Verify the number of platforms in the scenario.

disp(sc.Platforms)
    [1×1 fusion.scenario.Platform]    [1×1 fusion.scenario.Platform]

Run the simulation and plot the current position of each platform. Use an animated line to plot the position of each platform

figure
grid
axis equal
axis([-12 12 -12 12])
line1 = animatedline('DisplayName','Trajectory 1','Color','b','Marker','.');
line2 = animatedline('DisplayName','Trajectory 2','Color','r','Marker','.');
title('Trajectories')
p1 = pose(platfm1);
p2 = pose(platfm2);
addpoints(line1,p1.Position(1),p1.Position(2));
addpoints(line2,p2.Position(2),p2.Position(2));

while advance(sc)
    p1 = pose(platfm1);
    p2 = pose(platfm2);
    addpoints(line1,p1.Position(1),p1.Position(2));
    addpoints(line2,p2.Position(2),p2.Position(2));
    pause(0.1)
end

Plot the waypoints for both platforms.

hold on
plot(wpts1(:,1),wpts1(:,2),' ob')
text(wpts1(:,1),wpts1(:,2),"t = " + string(time1),'HorizontalAlignment','left','VerticalAlignment','bottom')
plot(wpts2(:,1),wpts2(:,2),' or')
text(wpts2(:,1),wpts2(:,2),"t = " + string(time2),'HorizontalAlignment','left','VerticalAlignment','bottom')
hold off

See Also

System Objects

Introduced in R2018b