Add New Vehicle
This document describes process of adding new vehicle model to Unity project.
Prepare Vehicle 3D model

A good example of how to prepare the 3D vehicle model prefab is Lexus RX450h which is already added and used in AWSIM project.
The model can be found under Assets/AWSIM/Models/Vehicles/Lexus RX450h 2015 directory.
To add new model user have to divide the model's meshes in the following parts:
- Body
- Each wheel
- Steering
The division needs also to be applied regarding the materials:
- HeadLight
- BrakeLight
- TurnSignal
- ReverseLight
Setup Physics & Collider

To make the vehicle model properly interact with other parts of simulation system, the following steps need to be conducted:
- Attach and configure
Rigidbody - Create
MeshColliderfor models body - Set up
WheelCollideron each wheel. Also attach the editor extension script forWheelColliderConfig.cs, which automatically sets unnecessary parameters ofWheelCollider. Set up parameters through theWheelColliderConfiginspector.
Attach control scripts
The last step is to attach proper component scripts to the vehicle model prefab. The scripts will make the vehicle controllable and interactive with Autoware:
-
Wheel.cs
Attach
Wheel.csscript to eachWheelColliderin the 3D modelproperty feature WheelCollider See Unity documentation WheelVisualTransform Reference to WheelVisual Object -
Vehicle.cs
Attach
Vehicle.csscript to vehicle root GameObjectproperty feature CenterOfMass Center of Mass position set by transform UseInertia Flag enabling moment of inertia usage Inertia Moment of inertia when UseInertiais enabled (kgm^2)Front, Rear Axle Reference to each Wheelcomponent -
VehicleVisualEffect.cs
Attach
VehicleVisualEffect.csscript to the GameObject to whichVehicle.csis attachedproperty feature Vehicle Reference to VehiclecomponentBrake Lights Brake light materials Left, Right Turn Signal Lights Turn signal light materials Turn Signal Timer Interval Sec Blink time of turn signal light Reverse Lights Reverse light materials -
VehicleROSInput.cs
Attach
VehicleROSInput.csscript to the GameObject to whichVehicle.csis attached. You can configure the topic of each msg to subscribe in ROS2. When this script is attached, default values are set.
Info
Attach VehicleKeyboardInput.cs for keyboard operation instead.