Follow Waypoints Around Oval Track
This example simulates a 3 degree-of-freedom (DOF) vehicle driving around an oval track that is specified by waypoints. The model contains waypoints and uses a MATLAB® function to determine the next heading waypoint.
To create your own track and use it Unreal®, you can use RoadRunner and a RoadRunner plugin. To simulate a vehicle on the track in Unreal, you need the Vehicle Dynamics Blockset™ Interface for Unreal Engine® 4 Projects support package. For more information, seeCreate and Use an Oval Track.
Waypoints
The model workspace contains a variable,TrackPoints
, that specifiesX
,Y
, and reference pose waypoints for an oval track like the Indy 500® racing track. The points areX
andY
locations in theZ
-down vehicle coordinate system, in m. The reference poses are specified in rad.
Run Simulation
On theSimulationtab, clickRun. As the simulation runs, the Vehicle Position window provides the trace of the vehicle as it moves around the track.
Oval Track Reference
The Oval Track Reference subsystem uses theTrackPoints
waypoints to generate the reference path. The subsystem also includes a MATLAB® Function block that determines the next heading waypoint based on the current vehicle position and pose. The reference block then provides the vehicle commands to the driver block.
See Also
Predictive Driver|MATLAB Function|Vehicle Body 3DOF