# Race

## State

### Accelerations

#### Declaration

``````getAccelerations()
``````

#### Example

``````val state:Race.State
assertTrue(state.accelerations[0].value?.direction == Acceleration.Direction.LONGITUDINAL)
assertTrue(state.accelerations[0].value?.acceleration?.value == 0.864)
assertTrue(state.accelerations[0].value?.acceleration?.unit == AccelerationUnit.Unit.GRAVITY)
// Longitudinal acceleration is 0.864g
``````

### Understeering

#### Declaration

``````getUndersteering()
``````

#### Discussion

The understeering percentage between 0.0-1.0 whereas up to 0.2 (20%) is considered OK, up to 0.3 (30%) marginal, over 30% critical

#### Example

``````val state:Race.State
assertTrue(state.understeering.value == 0.19)
// Understeering is at 19%
``````

### Oversteering

#### Declaration

``````getOversteering()
``````

#### Discussion

The oversteering percentage between 0.0-1.0 whereas up to 0.2 (20%) is considered OK, up to 30% marginal, over 30% critical

#### Example

``````val state:Race.State
assertTrue(state.oversteering.value == 0.05)
// Oversteering is at 5%
``````

### Gas pedal position

#### Declaration

``````getGasPedalPosition()
``````

#### Discussion

The gas pedal position between 0.0-1.0, whereas 1.0 (100%) is full throttle

#### Example

``````val state:Race.State
assertTrue(state.gasPedalPosition.value == 0.98)
// Gas pedal position is at 98%
``````

### Steering angle

#### Declaration

``````getSteeringAngle()
``````

#### Discussion

The steering angle, whereas 0.0 is straight ahead, positive number to the right and negative number to the left

#### Example

``````val state:Race.State
assertTrue(state.steeringAngle.value?.value == 10.0)
assertTrue(state.steeringAngle.value?.unit == Angle.Unit.DEGREES)
// Steering angle is 10° to right
``````

### Brake pressure

#### Declaration

``````getBrakePressure()
``````

Brake pressure

#### Example

``````val state:Race.State
assertTrue(state.brakePressure.value?.value == 20.0)
assertTrue(state.brakePressure.value?.unit == Pressure.Unit.BARS)
// Brake pressure is 20.0bar
``````

### Yaw rate

#### Declaration

``````getYawRate()
``````

Yaw turning rate

#### Example

``````val state:Race.State
assertTrue(state.yawRate.value?.value == 6.66)
assertTrue(state.yawRate.value?.unit == AngularVelocity.Unit.DEGREES_PER_SECOND)
// Yaw rate is 6.66°/s
``````

### Rear suspension steering

#### Declaration

``````getRearSuspensionSteering()
``````

#### Discussion

Rear suspension steering

#### Example

``````val state:Race.State
assertTrue(state.rearSuspensionSteering.value?.value == 3.3)
assertTrue(state.rearSuspensionSteering.value?.unit == Angle.Unit.DEGREES)
// Rear suspension steering is +3°
``````

### Electronic stability program

#### Declaration

``````getElectronicStabilityProgram()
``````

#### Example

``````val state:Race.State
assertTrue(state.electronicStabilityProgram.value == ActiveState.ACTIVE)
// ESP is active
``````

### Brake torque vectorings

#### Declaration

``````getBrakeTorqueVectorings()
``````

#### Example

``````val state:Race.State
assertTrue(state.brakeTorqueVectorings[0].value?.axle == Axle.FRONT)
assertTrue(state.brakeTorqueVectorings[0].value?.state == ActiveState.ACTIVE)
// Front brake torque vectoring is active
``````

### Gear mode

#### Declaration

``````getGearMode()
``````

#### Example

``````val state:Race.State
assertTrue(state.gearMode.value == Race.GearMode.DRIVE)
// Gear is in drive
``````

### Selected gear

#### Declaration

``````getSelectedGear()
``````

#### Discussion

The selected gear value, if any

#### Example

``````val state:Race.State
assertTrue(state.selectedGear.value == 4)
// 4th gear is selected
``````

### Brake pedal position

#### Declaration

``````getBrakePedalPosition()
``````

#### Discussion

The brake pedal position between 0.0-1.0, wheras 1.0 (100%) is full brakes

#### Example

``````val state:Race.State
assertTrue(state.brakePedalPosition.value == 0.12)
// Brake pedal position is at 12%
``````

### Brake pedal switch

#### Declaration

``````getBrakePedalSwitch()
``````

#### Example

``````val state:Race.State
assertTrue(state.brakePedalSwitch.value == ActiveState.ACTIVE)
// Brake pedal switch is active, brake lights active
``````

### Clutch pedal switch

#### Declaration

``````getClutchPedalSwitch()
``````

#### Example

``````val state:Race.State
assertTrue(state.clutchPedalSwitch.value == ActiveState.ACTIVE)
// Clutch pedal switch is active, clutch is fully depressed
``````

### Accelerator pedal idle switch

#### Declaration

``````getAcceleratorPedalIdleSwitch()
``````

#### Example

``````val state:Race.State
assertTrue(state.acceleratorPedalIdleSwitch.value == ActiveState.ACTIVE)
// Accelerator pedal idle switch is active, pedal released
``````

### Accelerator pedal kickdown switch

#### Declaration

``````getAcceleratorPedalKickdownSwitch()
``````

#### Example

``````val state:Race.State
assertTrue(state.acceleratorPedalKickdownSwitch.value == ActiveState.ACTIVE)
// Accelerator pedal kickdown switch is active, pedal fully depressed
``````

### Vehicle moving

#### Declaration

``````getVehicleMoving()
``````

#### Example

``````val state:Race.State
assertTrue(state.vehicleMoving.value == Race.VehicleMoving.MOVING)
// Vehicle is moving
``````

## Getters

### Get Race property availability information

#### Declaration

``````public GetStateAvailability()
public GetStateAvailability(byte... propertyIdentifiers)
``````

#### Example

``````// get all property availabilities
val getAvailability = GetStateAvailability()
// get acceleration and understeering property availabilities
val getAvailabilityProperties = GetStateAvailability(0x01, 0x02)
``````

### Get Race properties

#### Declaration

``````public GetState()
public GetState(byte... propertyIdentifiers)
``````

#### Example

``````// get all properties
val getState = GetState()
// get acceleration and understeering properties
val getStateProperties = GetState(0x01, 0x02)
``````