Modular Vehicles Tutorial 1: Creating a Vehicle Topology
This tutorial includes video content:
In this first module, we will setup the file structure as well as the topology of the drivetrain of an 8x8 land vehicle.
The goal is to fully create a modular vehicle without using templates. This will give you a better understanding of the structure of modular vehicles, allowing you to create complex powertrain systems.
Prerequisites
You need to have Vortex Studio and the Vortex Studio Samples and Demo Scenes installed to be able to follow all steps in this tutorial : https://asset-store.prod.vortex-cloud.net/
Creating the vehicle file structure
In your working directory, create a folder named AWD_8x8
Copy the Components folder (C:\CM Labs\Vortex Studio Content <version>\Samples\Vehicle Systems) to this new folder.
Create a Resources folder. We'll use this folder later in the tutorial.
In Vortex Studio, Create an Assembly. Save it in the AWD_8x8 folder and name it AWD_8x8.vxassembly.
Creating the vehicle topology
Open AWD_8x8.vxassembly, created in the previous section.
From the Basics section of the Toolbox, insert Assemblies From Files.
Select Chassis.vxassembly from ...\Components\Chassis
Repeat this process to add all the parts of the vehicle's powertrain:
Engine (Advanced)
Torque Converter (Advanced)
Automatic Transmission
Differentials (7)
Wheels (8)
Rename each wheels to identify their positions on the LAV ("FL" for Front Left, "FML" for Front Middle Left, etc.).
From the Basics section of the Toolbox, insert a Connection Container. Rename it "Chassis Connections"
Insert the Chassis Part Output from the Chassis Attachments VHL in the Chassis Assembly.
For each other component, find their Attachments VHL and insert the Chassis Part Input, connecting it to the Chassis Part Output of the Chassis assembly
From the Basics section of the Toolbox, insert a Connection Container. Rename it "Vehicle Topology"
Insert all Shaft Part Inputs and Parameters from the Engine, Torque Converter, Transmission, Differentials and Wheels Attachments VHL.
Connect Inputs and Parameters following to the topology below:
Insert Shaft RPM and Shaft Speed from the Engine Interface and Torque Converter Coupling Interface.
Insert Input Shaft Speed from the Transmission Interface and Torque Converter Coupling Interface.
Make these connections:
Creating a Wheel Positioner
From the Simulation section of the Toolbox, insert a Dynamics Script.
Close the resulting window and rename it "Wheel Positioner"
In the Code field of the extension, copy the following Python Code.
Wheel Positioner Code
from Vortex import * def on_simulation_start(self): create_input(self, 'Enable', Types.Type_Bool).setDescription("True to update positions") create_parameter(self, 'Wheel Position Front', Types.Type_VxReal).setDescription("Position of front axle") create_parameter(self, 'Wheel Position Front Middle', Types.Type_VxReal).setDescription("Position of front middle axle") create_parameter(self, 'Wheel Position Rear Middle', Types.Type_VxReal).setDescription("Position of rear middle axle") create_parameter(self, 'Wheel Position Rear', Types.Type_VxReal).setDescription("Position of rear axle") create_parameter(self, 'Wheel Spacing', Types.Type_VxReal).setDescription("Distance between left and right wheels") create_parameter(self, 'Wheel Height', Types.Type_VxReal).setDescription("Vertical position of wheels") create_output(self, 'Wheel FL Transform', Types.Type_VxMatrix44) create_output(self, 'Wheel FR Transform', Types.Type_VxMatrix44) create_output(self, 'Wheel FML Transform', Types.Type_VxMatrix44) create_output(self, 'Wheel FMR Transform', Types.Type_VxMatrix44) create_output(self, 'Wheel RML Transform', Types.Type_VxMatrix44) create_output(self, 'Wheel RMR Transform', Types.Type_VxMatrix44) create_output(self, 'Wheel RL Transform', Types.Type_VxMatrix44) create_output(self, 'Wheel RR Transform', Types.Type_VxMatrix44) def paused_update(self): config_update(self) def config_update(self): # Skip update if disabled if not self.inputs.Enable.value: return # Place wheels pos = VxVector3(self.parameters.Wheel_Position_Front.value, self.parameters.Wheel_Spacing.value/2.0, self.parameters.Wheel_Height.value) #Front self.outputs.Wheel_FL_Transform.value = createTranslation(pos) pos.y = -pos.y self.outputs.Wheel_FR_Transform.value = createTranslation(pos) #Front Middle pos.x = self.parameters.Wheel_Position_Front_Middle.value self.outputs.Wheel_FMR_Transform.value = createTranslation(pos) pos.y = -pos.y self.outputs.Wheel_FML_Transform.value = createTranslation(pos) #Rear Middle pos.x = self.parameters.Wheel_Position_Rear_Middle.value self.outputs.Wheel_RML_Transform.value = createTranslation(pos) pos.y = -pos.y self.outputs.Wheel_RMR_Transform.value = createTranslation(pos) #Rear pos.x = self.parameters.Wheel_Position_Rear.value self.outputs.Wheel_RR_Transform.value = createTranslation(pos) pos.y = -pos.y self.outputs.Wheel_RL_Transform.value = createTranslation(pos) def create_output(extension, name, o_type, default_value=None): """Create output field with optional default value, reset on every simulation run.""" if extension.getOutput(name) is None: extension.addOutput(name, o_type) if default_value is not None: extension.getOutput(name).value = default_value return extension.getOutput(name) def create_parameter(extension, name, p_type, default_value=None): """Create parameter field with optional default value set only when the field is created.""" if extension.getParameter(name) is None: field = extension.addParameter(name, p_type) if default_value is not None: field.value = default_value return extension.getParameter(name) def create_input(extension, name, i_type, default_value=None): """Create input field with optional default value set only when the field is created.""" if extension.getInput(name) is None: field = extension.addInput(name, i_type) if default_value is not None: field.value = default_value return extension.getInput(name)From the Basics section of the Toolbox, insert a Connection Container. Rename it "Wheel Positioner Connections"
Connect the Wheel Transform Outputs from the script to the Local Transform of each wheel assembly.
From the Basics section of the Toolbox, insert a Folder. Rename it "Components". Insert all of the other extensions into this folder.
From the Simulation section of the Toolbox, insert a VHL Interface. Rename it "Component Configuration".
Drag and drop the Parameters of the Wheel Positioner script into its Parameters section.
Add the Body Attachment Point Parameter from the Chassis Attachments VHL in the Chassis.
Adding Wheel and Suspension Tuning Interface
From the Simulation section of the Toolbox, insert a VHL Interface. Rename it "Wheel and Suspension Tuning"
Add and group all of the following Inputs from the Wheel Interface VHL from each wheel in the Wheel and Suspension Tuning interface.
Radius
Width
Mass
Suspension Stiffness
Suspension Damping
Type Type
Tire Stiffness
Adding Engine Tuning Interface
From the Simulation section of the Toolbox, insert a VHL Interface. Rename it "Engine Tuning".
From the Engine Interface VHL, insert the following Inputs and Parameters in the Parameters section of this new VHL.
Torque Scale
Braking Torque Scale
Shaft Mass
Shaft Inertia
Torque Table
Braking Torque Table
Adding Torque Converter Tuning Interface
From the Simulation section of the Toolbox, insert a VHL Interface. Rename it "Torque Converter Tuning".
From the Coupling Interface VHL, insert the following Inputs and Parameters in the Parameters section of this new VHL.
Stall RPM
Stall Torque
All Parameters.