Simple Terrain Database Creation and Simulink Terrain Query for Vehicle Simulation

Allows Simulink vehicle models to drive on terrain databases, in particular a closed-loop race track
Updated 14 May 2018

View License

The Simple Terrain Database Creation and Simulink Terrain Query for vehicle simulation group of files provides examples of processing a race track image of the racing course into a triangle database for a Simulink vehicle model to drive on. The terrain database and terrain query for a vehicle model is one component to lap time simulation.
The two m-file scripts to begin with are:
(1) process_track_into_terrain_database.m - this has a documented process for reading a raster image, extracting inner and outer track edges and generating a triangle-based terrain database for use with the Simulink model described below.
(2) setup.m - this loads a triangle-based terrain database from a .mat file (created by process_track_into_terrain_database.m) and prepares the workspace for a Simulink model to query the database with N test points at each Simulink timestep. The intent is that a 4-tire vehicle model can query the terrain database to discern which triangle the tire is on to use the corresponding terrain property for that triangle. Or, simply knowing which triangle the tire is on helps determine if the tire is still on or off the track.
A terrain database is one part of a vehicle's laptime simulation, along with the vehicle mobility model, powertrain, visualization, and path navigator or driver inputs subsystem.

See .\Documentation folder for lecture note excerpts from ME620 Advanced Vehicle Dynamics in the mechanical engineering department at Embry-Riddle Aeronautical University. These lecture notes explain track image processing and terrain triangle generation, terrain query runtime in Simulink, and laptime simulation.

Marc Compere,
created : 21 Apr 2018
modified: 14 May 2018

Cite As

Marc Compere (2024). Simple Terrain Database Creation and Simulink Terrain Query for Vehicle Simulation (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2016b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Find more on Animation in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!


Version Published Release Notes

- Updated lecture notes from ME620, Advanced Vehicle Dynamics course in .\Documentation folder.
- removed .mex64 in zipfile. Mex file's C source is provided and must be compiled locally.

Updated documentation