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 in 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® Projects support package. For more information, see Create and Use an Oval Track.
Waypoints
The model workspace contains a variable, TrackPoints
, that specifies X
, Y
, and reference pose waypoints for an oval track like the Indy 500® racing track. The points are X
and Y
locations in the Z
-down vehicle coordinate system, in m. The reference poses are specified in rad.
Run Simulation
On the Simulation tab, click Run. 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 the TrackPoints
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