%% Record Actor Poses from Driving Scenario
% Create a driving scenario in which one car passes a stationary car on a two-lane road.

scenario = drivingScenario;
road(scenario,[0 0; 10 0; 53 -20],'lanes',lanespec(2));
plot(scenario,'Waypoints','on');
stationaryCar = vehicle(scenario,'ClassID',1,'Position',[25 -5.5 0],'Yaw',-22);

passingCar = vehicle(scenario,'ClassID',1);
waypoints = [1 -1.5; 16.36 -2.5; 17.35 -2.765; ...
            23.83 -2.01; 24.9 -2.4; 50.5 -16.7];
speed = 15; % m/s
smoothTrajectory(passingCar,waypoints,speed);

%
% Record the driving scenario simulation.

rec = record(scenario);

%
% Compare the recorded poses of the passing car at the start and end of the simulation.

rec(1).ActorPoses(2)
rec(end).ActorPoses(2)

% Copyright 2018 The MathWorks, Inc.