record
Run driving scenario and record actor states
Syntax
Description
Examples
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)
ans = struct with fields:
ActorID: 2
Position: [1 -1.5000 0]
Velocity: [14.9816 0.7423 0]
Roll: 0
Pitch: 0
Yaw: 2.8367
AngularVelocity: [0 0 1.2537e-05]
rec(end).ActorPoses(2)
ans = struct with fields:
ActorID: 2
Position: [50.4717 -16.6823 0]
Velocity: [12.7171 -7.9546 0]
Roll: 0
Pitch: 0
Yaw: -32.0261
AngularVelocity: [0 0 -0.0099]
Input Arguments
scenario
— Driving scenario
drivingScenario
object
Driving scenario, specified as a drivingScenario
object.
Output Arguments
rec
— Recording of actor states during simulation
M-by-1 vector of structures
Recording of actor states during simulation, returned as an M-by-1 vector of structures. M is the number of time steps in the simulation. Each structure corresponds to a simulation time step.
The rec
structure has these fields:
Field | Description | Type |
---|---|---|
SimulationTime | Simulation time at each time step | Real scalar |
ActorPoses | Actor poses in scenario coordinates | N-by-1 vector of
ActorPoses structures, where
N is the number of actors,
including vehicles. |
Each ActorPoses
structure has these fields.
Field | Description |
---|---|
ActorID | Scenario-defined actor identifier, specified as a positive integer. |
In R2024b:
| Front-axle position of the vehicle, specified as a three-element row vector in the form [x y z]. Units are in meters. Note If the driving scenario does not contain a
front-axle trajectory for at least one vehicle,
then the
|
Position | Position of actor, specified as a real-valued vector of the form [x y z]. Units are in meters. |
Velocity | Velocity (v) of actor in the x- y-, and z-directions, specified as a real-valued vector of the form [vx vy vz]. Units are in meters per second. |
Roll | Roll angle of actor, specified as a real-valued scalar. Units are in degrees. |
Pitch | Pitch angle of actor, specified as a real-valued scalar. Units are in degrees. |
Yaw | Yaw angle of actor, specified as a real-valued scalar. Units are in degrees. |
AngularVelocity | Angular velocity (ω) of actor in the x-, y-, and z-directions, specified as a real-valued vector of the form [ωx ωy ωz]. Units are in degrees per second. |
For full definitions of these structure fields, see the actor
and vehicle
functions.
Data Types: struct
Version History
Introduced in R2017aR2024b: Output ActorPoses
structure contains front-axle position information
If a driving scenario contains a front-axle trajectory for at least one vehicle,
the ActorPoses
structure in the output rec
structure now returns the front-axle position in the form [x
y
z] for vehicles specified with front-axle steering.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)