Simple Animation for N vehicles

version 1.0.0.0 (3.22 MB) by Marc Compere
This simulates and animates multiple 2D kinematic vehicle models in Simulink

426 Downloads

Updated 25 Apr 2018

View License

-------------------------------------------------------------------------------
This is the Readme file for a simple 2D kinematic vehicle animation for N separate vehicles implemented in Matlab's Simulink. There are no special libraries or additional toolboxes required.
The simulink model simulates and displays N vehicles at each timestep. This version was based on the single vehicle version located here:
https://www.mathworks.com/matlabcentral/fileexchange/54852-simple-2d-kinematic-vehicle-steering-model-and-animation

Software Versions Tested:
-------------------------
This model was developed and tested using Matlab R2014, R2015, R2016b and should work with most other versions. The animation s-function is a modified version of the level 1 m-file s-function from the Mathworks example provided in sanim.m.

Writing .jpeg animation frames to disk at each animation interval slows the simulation considerably. Set animation frames per second, anim_fps, in setup.m and re-run setup.m. Don't forget to turn off your file synchronization services to avoid syncing all the new image files.

Getting started:
-------------------------
Get started by unzipping the .zip file, changing directories to the folder, then running setup.m
at the Matlb command prompt. This will clear the workspace then populate it with the necessary variables to run the Simulink model and associated animation. It will also open the Simulink model file. Press Play or Simulation | Run to execute the Simulink model. The light blue s-function block will bring up the 2D animation figure window and display the steering vehicle at anim_fps frames per second.

-------------------------------------------------------------------------------
Distribution file list:
-------------------------------------------------------------------------------
[00_Readme.mdc.txt] - this file

[setup.m] - run this first, it will bring up the Simulink, then press play to simulate the vehicle

[createAviMovieFromAnimationSequence.m] - auxiliary m-file script for converting a sequence of .jpg images into an Avi using Matlab's VideoWriter() function.

[sanim_XY_vehicle_viz_multi.m] - Simulink m-file s-function that displays N vehicle's of Matlab graphics objects each animation interval, set by anim_fps in setup.m.

[veh_object2.m] - supporting m-file function to create vertices and faces for vehicle and tire graphics objects

[vehicle_animation_sim_multi.jpg] - desktop screenshot showing the Simulink model and animation window

[vehicle_animation_sim_multi.pdf] - printout of the Simulink block diagram in case you cannot open the Simulink

[vehicle_animation_sim_multi.slx] - Matlab/Simulink R2016b model that expressed non-holonomically constrained (rolling) CG velocities and solves for vehicle position as a function of time.

[.\anim_sequences] - folder where animation frame sequence .jpg files are stored; change this in sanim_XY_vehicle_viz_multi.m

[.\Documentation\ folder containing excerpts from lectre notes for ME620 Advanced Vehicle Dynamics

-----------------------------------
Marc Compere, comperem@gmail.com
created : 11 Jan 2016
modified: 24 Apr 2018
-----------------------------------

Cite As

Marc Compere (2022). Simple Animation for N vehicles (https://www.mathworks.com/matlabcentral/fileexchange/67034-simple-animation-for-n-vehicles), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2016b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!

simple_2D_steering_animation_v3/