Main Content

Generate Skidpad Test

This example shows how to simulate a skidpad test similar to events held in student competitions by Formula Student, Formula SAE, and other organizations internationally. In these, student teams build, operate, and present vehicles of their own design.

In this example, the vehicle starts from rest, then:

  1. Accelerates to enter the course

  2. Completes two clockwise laps

  3. Reverses its steering direction

  4. Completes two counterclockwise laps

  5. Exits and brakes to a stop

Open Model

The skidpad model includes a reference path, driver, vehicle, and visualization aides. To open the model, use this command.


The model workspace variable TrackPoints contains the reference waypoints used to define the reference pose. You can edit or replace them with waypoints of your own. To plot the waypoints, use this code.

mdlWks = get_param('vdynblksskidpad','ModelWorkspace');
TrackPoints = evalin(mdlWks,'TrackPoints');
hold on
arrowLen = 1.5;
box on
grid on
xlabel('Y [m]')
ylabel('X [m]')
axis equal
legend('Waypoints','Path Direction')

The default vehicle path follows the centerline of the course, with some X,Y points duplicated because the vehicle completes multiple laps. You can change factors such as the number of laps or scaling via the blocks found in the Skidpad Reference subsystem. You can also experiment with path points to improve lap times.

Simulate Model

To run the model and observe the vehicle completing the course, use this command.


By default, an overhead figure depicting the reference and simulated vehicle path, and acceleration diagram are opened and updated during simulation. Lap times are estimated and displayed in order at the top level of the model via a Display block.

You can model the vehicle as either of two variant subsystems, using blocks from the Vehicle Dynamics Blockset library: Simulink Physics or Game Engine Physics. To set the vehicle type, double-click the Formula Student Vehicle block and select from the Vehicle Type list. To set the vehicle type programmatically, use the set_param command.

By default, the Simulink Physics setting uses a 7DOF vehicle containing multiple subsystems and components, including an ideal powertrain, driveline, tires, and chassis. The Game Engine Physics setting has similar parameters but uses a simulation 3D interface to configure and solve for the dynamic response of the predefined vehicle template. Given the differences in tire models and solver engines between the two settings, differences in results are to be expected. Choose your setting based on your modeling and visualization preferences.

Use this command to set the model to use the game engine vehicle.

vehType = "Game Engine Physics"
vehType = 
"Game Engine Physics"
% set_param( 'vdynblksskidpad/Formula Student Vehicle','vehType',vehType);

Enable 3D Visualization

Before running the model in the 3D visualization environment, review the Unreal Engine Simulation Environment Requirements and Limitations. To enable the 3D visualization, use these commands.

 set_param('vdynblksskidpad/Visualization/3D Visualization','engine3D','Enabled - Simulink 3D Vehicle')

To add cones and a skidpad lane boundary texture use the following:

set_param('vdynblksskidpad/Visualization/3D Visualization','conesOn','on');

To include tire force, vehicle and driveline annotations use the following:

set_param('vdynblksskidpad/Visualization/3D Visualization','annotOn','on');

And now run the simulation:


You can also place cones with Simulink 3D Animation to better define the skid pad course when using the 3D visualization engine. You can adjust cone placement through the initialization script in the Simulation 3D Actor block.

See Also

| (Simulink 3D Animation)

Related Topics