This example simulates a 3 degree-of-freedom (DOF) vehicle driving around an oval track that is specified by waypoints. The model loads a minimum number of 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, see Install Support Package and Configure Environment.
On the model canvas, click Load Waypoints to load a minimum number of waypoints and corresponding reference poses. This action loads waypoints that specify an oval track like the Indy 500 racing track.
The waypoints are specified as the
Y locations in the
Z -down vehicle coordinate system, in m. The reference poses are specified in deg.
Loading the waypoints also creates equally spaced intermediate waypoints and reference poses for the straight-line and circular portions of the track.
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.
The Oval Track Reference block 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.