Data Bus reference #
The Data Bus is the standard method for communicating with vehicles in Vehicle Physics Pro. It's inspired in the ODB-II standard:
- Immediate access O(1)
- Direct, non-blocking read/write access from all clients
- Data transport only: no error control, no range checking
- Stores integer values only. Float values may be represented as fixed-resolution decimals (ie: 1.0 = 10000)
- NaN is gracefully supported as integer:
(int)NaN = -2147483647
- Full forwards-backwards compatibility along versions.
Add-on components (VehicleBehaviour) may use the data bus for
reading/writing values. Values are arranged into channels. Accessing a specific value requires
ChannelId, ValueId. The standard Channels and their available values are referenced below.
Accessing the data bus #
The bus is accessed via public property
data exposed in VehicleBase.
Use code like this within a VehicleBehaviour-derived component (or any
other component with a reference to the vehicle controller):
// Set the input for the steering wheel. vehicle.data.Set(Channel.Input, InputData.Steer, (int)(Input.GetAxis("Horizontal") * 10000)); // Read the engine rpm value float engineRpm = vehicle.data.Get(Channel.Vehicle, VehicleData.EngineRpm) / 1000.0f;
The bus may also be accessed via  operators:
vehicle.data[Channel.Input][InputData.Steer] = (int)(Input.GetAxis("Horizontal") * 10000); float engineRpm = vehicle.data[Channel.Vehicle][VehicleData.EngineRpm] / 1000.0f;
Data Channels #
|Input||Write only||States of the vehicle input elements.
Intended for writing, but the states may be read for representing the actual positions of the elements in the vehicle 3D model (i.e. steering wheel, gear stick...)
|Vehicle||Read only||State values of the internal parts of the vehicle|
|Settings||Read/Write||Common configuration settings|
Input channel #
|Steer||Steering wheel position||%||10000||-10000 = full left, 0 = center, +10000 = full right|
|Throttle||Throttle pedal position||%||10000||10000 = 1.0 = 100%|
|Brake||Brake pedal position||%||10000||5000 = 0.5 = 50%|
|Handbrake||Handbrake position||%||10000||5000 = 0.5 = 50%|
|Clutch||Clutch pedal position||%||10000||5000 = 0.5 = 50%|
|ManualGear||Manual gear lever position||gear number||-1 (reverse), 0 (neutral), 1, 2, 3, ...|
|AutomaticGear||Automatic transmission mode 1||gear mode||0, 1, 2, 3, 4, 5 = M, P, R, N, D, L 1|
|GearShift||Incremental gear shifting value 2||gear increment||Add +1 for gear up or -1 for gear down 2|
|Retarder||Retarder brake stick position 3||retarder level||0 (off), 1, 2, 3, ...|
|Key||Ignition key position||key position||-1 = off, 0 = acc-on, 1 = start|
- 1 Automatic transmission modes:
- M (0): Manual: do not automatically engage gears. Use manual gear shifting.
- P (1): Park
- R (2): Reverse. Gear shifting is supported for more than one reverse gears.
- N (3): Neutral
- D (4): Drive: automatically engage forward gears. Gear shifting is supported for forward gears.
- L (5): Low: first gear only.
2 GearShift value is reset to 0 when the vehicle has acknowledged and processed the input. Successive gear shift commands can be grouped by adding/subtracting +-1 to this bus value.
3 Retarder uniformly controls the continuous braking systems when available.
Vehicle channel #
|Speed||Vehicle absolute velocity||m/s||1000||14500 = 14.5 m/s|
|EngineRpm||Engine RPMs||rpm||1000||1200000 = 1200 rpm|
|EngineStalled||Is the engine stalled?||0 = normal operation or switched off, 1 = engine stalled|
|EngineWorking||Is the engine up and running?||0 = engine is off (stalled or switched off), 1 = engine up and running|
|EngineStarting||Is the engine starting as per the ignition input?||0 = no, 1 = yes|
|EngineLimiter||Is the rpm limiter cutting engine power?||0 = no, 1 = yes|
|EngineLoad||How much load is demanded||%||1000||200 = 0.2 = 20%|
|EngineTorque||Torque at the output of the engine||Nm||1000||200000 = 200 Nm|
|EnginePower||Power developed by the engine||kW||1000||10000 = 10 kW|
|EngineFuelRate||Instant fuel consumption||g/s||1000||20230 = 20.23 g/s|
|ClutchTorque||Torque at the output of the clutch in Nm||Nm||1000||150000 = 150 Nm|
|ClutchLock||Lock ratio of the clutch||%||1000||800 = 0.8 = 80%|
|GearboxGear||Engaged gear||gear number||Negative = reverse, 0 = Neutral or Park, Positive = forward.|
|GearboxMode||Actual transmission mode||gear mode||0, 1, 2, 3, 4, 5 = M, P, R, N, D, L|
|GearboxShifting||Is the gearbox in the middle of a gear shift operation?||0 = no, 1 = yes|
|RetarderTorque||Brake torque injected in the driveline by the retarder||Nm||1000||2000000 = 2000 Nm|
|TransmissionRpm||Rpms at the output of the gearbox||rpm||1000||100000 = 100 rpm|
|AbsEngaged||Is the ABS being engaged in any wheel?||0 = no, non-zero = yes|
|TcsEngaged||Is the TCS limiting the engine throttle?||0 = no, non-zero = yes|
|EscEngaged||Is the ESC applying brakes for keeping stability?||0 = no, non-zero = yes|
|AsrEngaged||Is the ASR applying brakes for reducing wheel slip?||0 = no, non-zero = yes|
|AidedSteer||Steering wheel position after steering aids||%||10000||-10000 = full left, 0 = center, +10000 = full right|
|FuelConsumption||Overall fuel consumption||l/100km||1000||20230 = 20.23 l/100km|
Settings channel #
|DifferentialLock||Override lock setting at the differential1||0 = no override, 1 = force locked differential, 2 = force open differential|
|DrivelineLock||Override lock setting at the driveline2||0 = no override, 1 = force locked driveline, 2 = force unlocked / open driveline|
|AutoShiftOverride||Auto-shift override setting||0 = no override, 1 = force auto shift, 2 = force manual shift|
|AbsOverride||ABS override setting||0 = no override, 1 = force ABS enabled, 2 = force ABS disabled|
|EscOverride||ESC override setting||0 = no override, 1 = force ESC enabled, 2 = force ESC disabled|
|TcsOverride||TCS override setting||0 = no override, 1 = force TCS enabled, 2 = force TCS disabled|
|AsrOverride||ASR override setting||0 = no override, 1 = force ASR enabled, 2 = force ASR disabled|
|SteeringAidsOverride||Steering Aids override setting||0 = no override. 2 = force all steering aids disabled.|
1 DifferentialLock affects the axle differentials only.
2 DrivelineLock affects the element connecting the front-rear regions of the driveline. This element might be either a differential or a torque splitter.