%Create a driving scenario.
scenario = drivingScenario;
plot(scenario,'Meshes','on');
%Add a straight road to the driving scenario. The road has one lane in each direction.
roadCenters = [0 0 0; 70 0 0];
laneSpecification = lanespec([1 1]);
road(scenario,roadCenters,'Lanes',laneSpecification);
%Add an ego vehicle to the driving scenario.
egoVehicle = vehicle(scenario,'ClassID',1,'Mesh',driving.scenario.carMesh);
waypoints = [1 -2 0; 35 -2 0];
speed = 10;
trajectory(egoVehicle,waypoints,speed);
%Add a truck, pedestrian, and bicycle to the driving scenario and plot the scenario.
truck = vehicle(scenario,'ClassID',2,'Length', 8.2,'Width',2.5,'Height',3.5,...
'Mesh',driving.scenario.truckMesh);
waypoints = [70 1.7 0; 20 1.9 0];
speed = 15;
trajectory(truck,waypoints,speed);
pedestrian = actor(scenario,'ClassID',4,'Length',0.24,'Width',0.45,'Height',1.7, ...
'Mesh',driving.scenario.pedestrianMesh);
waypoints = [23 -4 0; 10.4 -4 0];
speed = 1.5;
trajectory(pedestrian,waypoints,speed);
bicycle = actor(scenario,'ClassID',3,'Length',1.7,'Width',0.45,'Height',1.7, ...
'Mesh',driving.scenario.bicycleMesh);
waypoints = [12.7 -3.3 0; 49.3 -3.3 0];
speed = 5;
trajectory(bicycle,waypoints,speed);
while advance(scenario)
pause(0.01);
end