SCRC v0.2.0 Scrc.SensorData View Source

SensorData provides the struct for SCRC sensor data.

Link to this section Summary

Functions

Clip values according to field specification

Parse binary according to field/prefix specification and return Struct

Create new Struct based on values. Apply post-processing (if needed)

Callback for postprocessing after creation from binary

Create binary from struct according to field/prefix specification

Update fields based on current and previous data

Link to this section Types

Link to this type t() View Source
t() :: %Scrc.SensorData{
  acceleration_x: :float,
  acceleration_y: :float,
  acceleration_z: :float,
  angle: :float,
  current_lap_time: :float,
  damage: :integer,
  distance_from_start: :float,
  distance_raced: :float,
  focus: {:float, :float, :float, :float, :float},
  fuel: :float,
  gear: :integer,
  last_lap_time: :float,
  opponents: [:float],
  race_position: :integer,
  rpm: :integer,
  speed_x: :float,
  speed_y: :float,
  speed_z: :float,
  track: [:float],
  track_position: :float,
  wheel_spin_velocity: {:float, :float, :float, :float},
  z: :float
}

Link to this section Functions

Clip values according to field specification

Link to this function from_binary(binary) View Source
from_binary(binary()) :: Scrc.SensorData.t()

Parse binary according to field/prefix specification and return Struct

Create new Struct based on values. Apply post-processing (if needed).

Callback for postprocessing after creation from binary.

By default simply return the passed data

Create binary from struct according to field/prefix specification.

Link to this function update_deltas(new_data, old_data) View Source

Update fields based on current and previous data