EGO Vehicle Dynamics

SVL Simulator supports multiple dynamics models for EGO vehicles. The default dynamics model is a C# based model that uses Unity's PhysX physics engine and components. The model receives controller input and applies force to the Unity wheel colliders. For users who would like to change or replace vehicle dynamics with their own models, the simulator offers the following ways to do so.

  • Simple Model Interface - pure C# dynamics

  • Full Model Interface - FMI 2.0 supported dynamics

Simple Model Interface top#

Simple Model Interface is our pure C# dynamic model. SVL Simulator vehicles that are provided, use the VehicleSMI class. It is located in Assets -> Scripts -> Dynamics -> Examples. This class inherits IVehicleDynamics and has required methods for simulation. Users can make any pure C# dynamic model class as long as it inherits IVehicleDynamics and is compiled in SVL Simulator run-time executable. If creating a new SMI class, place in Assets -> Scripts -> Dynamics folder. Future updates will create a dll of the class so it won't need to be compiled in the simulator executable.

Simple Model Interface Setup top#

  1. Create or select an EGO vehicle prefab in the Project panel only, not in scene

  2. Double click this EGO vehicle prefab. This opens the prefab editor scene

  3. Remove VehicleSMI.cs from the vehicle component list in the Inspector panel. This is the component that you are replacing with your own

  4. Add your new c# dynamics class component that inherits IVehicleDynamics

  5. If you plan to use Unity's physics engine, be sure to look at how VehicleSMI caches references to the wheel colliders and wheel meshes. This AxleInfo, in the C# example, enables you to apply force to the wheels and match the movement to the wheel models.

  6. Set any public references needed for your new dynamics model and save the prefab, Ctrl-S

  7. Open Simulator -> Build... to open the SVL Simulator bundle creation window

  8. Select Ego vehicle

  9. Select Build and after it is completed, in the root of the SVL Simulator you will have a folder called AssetBundles where the new bundles will be created. The new vehicle will be in AssetBundles/Vehicles folder.

  10. Open Loader.scene, run in editor and open the WebUI by pressing the Open Browser button in the Game panel view

  11. Under Library -> Vehicles select Add New

  12. Drag the new bundle into the target area to upload the vehicle or select from file folders.

  13. Set the vehicle details. Be sure to rename the vehicle so it isn't confused with other dynamics.

  14. Create a new sensor configuration.
  15. Publish the new vehicle.
  16. Create new simulation and select this new vehicle.

Full Model Interface top#

Full Model Interface supports FMI2.0 Functional Mock-up Interface. Since user FMU's can vary greatly, we have provided an exampleFMU.fmu for testing in Windows only. It can be found in the source code in Assets -> Resources. ExampleVehicleFMU.cs is provided to see how the Full Model Interface system works. It is located in Assets -> Scripts -> Dynamics -> Examples. Users can create their own FMU class that inherits from IVehicleDynamics but will need to be compiled with the simulator.

  1. Create or select an EGO vehicle prefab in the Project panel only, not in scene
  2. Double click this EGO vehicle prefab. This opens the prefab editor scene
  3. Remove VehicleSMI.cs from the vehicle component list in the Inspector panel. This is the component that you are replacing
  4. Add Component ExampleVehicleFMU.cs

ExampleFMU.fmu requires Unity physics solver

  1. Toggle button Non Unity Physics to Unity Physics
  2. Set Axles size to 2
  3. Setup Axles data. You will be dragging gameobjects from the Hierarchy panel to the Inspector panel
  4. Drag the correct wheel colliders and wheel meshes to public references from the prefab, see SMI setup
  5. Enable Motor and Steering for the front axle
  6. Set Brake Bias to 0.5f for front and back axles

Import the ExampleFMU.fmu

  1. Toggle button Import FMU
  2. Choose ExampleFMU.fmu in Assets -> Resources -> ExampleFMU.fmu
  3. FMU will unpack in the repository vehicle folder in External -> Vehicles -> VehicleName -> FMUName folder
  4. FMUImporter.cs will parse the XML file into FMUData in the VehicleFMU class instance on prefab
  5. Model Variables will be listed so users can reference by index
  6. Each model variable has multiple values that are displayed in the scroll area
  7. Open Simulator -> Build... to open the SVL Simulator bundle creation window
  8. Select the new Ego vehicle to build
  9. Select Build and after it is completed, in the root of the SVL Simulator you will have a folder called AssetBundles/Vehicles where the new bundles will be created.
  10. Open Loader.scene, run in editor and open the WebUI by pressing the Open Browser... button in the Game panel view
  11. Under Library -> Vehicles select Add New
  12. Drag the new bundle into the target area to upload the vehicle or select from file folders.
  13. Set the vehicle details. Be sure to rename the vehicle so it isn't confused with other dynamics.
  14. Create a new sensor configuration.
  15. Publish the new vehicle.
  16. Create new simulation and select this new vehicle.

Full Model Interface Run-time behavior top#

SVL Simulator only supports one FMU vehicle and for Windows only.