Accel vehicle
AccelVehicle is acceleration based vehicle. This vehicle model was created for Autoware simulation, and assuming that Autoware has already created a gas pedal map, this vehicle model uses acceleration as an input value. It has the following features:
- Longitudinal control by acceleration (\(\frac{m}{s^2}\)).
- Lateral control by two-wheel model.
- Yaw, roll and pitch controlled by Physics engine.
- Mass-spring-damper suspension model (
WheelColliders). - automatic gears change.
- 3D Mesh as road surface for vehicle driving, gradient resistance.
Prefab
Please refer to Lexus RX450h 2015.prefab as a sample prefab
Related classes
| Class | Feature |
|---|---|
| AccelVehicle | The main script of AccelVehicle. |
| AccelVehicleGroundSlip | Apply slip to AccelVehicle. |
| AccelVehicleVisualEffect | Visuals such as tires and lights for AccelVehicle. |
| IReadOnlyAccelVehicle | Read only interface of AccelVehicle. |
| AccelVehicleControlModeBasedInputter | Input classes supporting Autoware control input override. |
| AccelVehicleKeyboardInput | Keyboard input for AccelVehicle. |
| AccelVehicleLogitechG29Input | Logitech G29 steering wheel input for AccelVehicle. |
| AccelVehicleRos2Input | ROS2 input for AccelVehicle. |
| IAccelVehicleInput | Interface for input class. |
| AccelVehicleControlModeSrvServer | ROS2 service server with switchable Autoware's vehicle control mode. |
| AccelVehicleReportRos2Publisher | ROS2 publisher to publish topics for Autoware's vehicle report. |
| AccelVehicleRos2MsgConverter | ROS (Autoware) and Unity (Awsim) type conversion. |
Autoware's vehicle control mode
Assigned key list
By default, each key is assigned to the following classes.
- AccelVehicleKeyboardInput
| Key | Feature |
|---|---|
| D | Switch to move drive gear. |
| R | Switch to move reverse gear. |
| N | Switch to neutral gear. |
| P | Switch to parking gear. |
| C | Switch control mode to AUTONOMOUS. |
| Up arrow | Forward acceleration. |
| Down arrow | Reverse acceleration. |
| Left arrow | Left turning. |
| Right arrow | right turning. |
| 1 | Turn left blinker on. |
| 2 | Turn right blinker on. |
| 3 | Turn on hazard lights. |
| 4 | Turn off blinker or hazard lights. |
- AccelVehicleLogitechG29Input
| Key | Feature |
|---|---|
| Triangle | Switch to move drive gear. |
| Square | Switch to move reverse gear. |
| Circle | Switch to neutral gear. |
| Cross | Switch to parking gear. |
| L2 | Swtich control mode to MANUAL. |
| L3 | Switch control mode to AUTONOMOUS. |
| Throttle pedal | Forward acceleration. |
| Brake pedal | Reverse acceleration. |
| Steering wheel | Turning. |
| Left paddle | Turn left blinker on. |
| Right paddle | Turn right blinker on. |
| R2 | Turn on hazard lights. |
| R3 | Turn off blinker or hazard lights. |
Create custom vehicle
It is easier to understand if you refer to Lexus RX450h 2015.prefab.
- Prepare a 3D model of the vehicle. (Separate the wheels, body and lights)
- Set up
WheelColliderfor each wheel andMeshCollideror other collider for vehicle body. - Attach the
Rigidbodycomponent to the vehicle and configure inspector. - Attach the
AccelVehicle.csscript to the vehicle and configure inspector. - Attach the
AccelVehicleVisualEffect.csscript to the vehicle and configure inspector. - Attach the
AccelVehicleControlModeBasedInputterscript the vehicle and configure inspector. - Attach and configure any VehicleInput classes (
AccelVehicleKeyboardInput,AccelVehicleRos2Input,AccelVehicleLogitechG29Input) that inherits fromIAccelVehicleInput. - (optional) By attaching
AccelVehicleReportRos2PublisherandAccelVehicleControlModeSrvServer, it is possible to connect to Autoware.
Create custom input
- Create a new class that inherits from
IAccelVehicleInput. - Implement updates to the values of
IAccelVehicleInputinput values. - Reference the custom input class you created to
AccelVehicleControlModeBasedInputterand use it in either autonomous mode or manual mode.