Protocols Module Reference
Module defined in `lua/vehicle/protocols.lua`. Manages external telemetry export over UDP for motion simulator platforms, external dashboards, and hardware gauges. Smooths and packages vehicle state data (position, velocity, acceleration, orientation) into standardized binary packets at configurable update rates. Supports OutGauge (dashboard telemetry) and MotionSim (motion platform) standards.
Module defined in lua/vehicle/protocols.lua. Manages external telemetry export over UDP for motion simulator platforms, external dashboards, and hardware gauges. Smooths and packages vehicle state data (position, velocity, acceleration, orientation) into standardized binary packets at configurable update rates. Supports OutGauge (dashboard telemetry) and MotionSim (motion platform) standards.
See Also
- Protocols Folder: Specific standards (MotionSim, OutGauge).
- Communication: General Inter-VM logic.
State Fields
| Variable | Description |
|---|---|
accXSmoothed, accYSmoothed, accZSmoothed | Smoothed acceleration components (m/s²). |
posX, posY, posZ | Current world position (meters). |
rollAccSmoothed, pitchAccSmoothed, yawAccSmoothed | Smoothed angular accelerations (rad/s²). |
rollPosSmoothed, pitchPosSmoothed, yawPosSmoothed | Smoothed orientation angles (rad). |
rollVelSmoothed, pitchVelSmoothed, yawVelSmoothed | Smoothed angular velocities (rad/s). |
upX, upY, upZ | World-space "Up" direction vector. |
velXSmoothed, velYSmoothed, velZSmoothed | Smoothed world velocity (m/s). |
Public API
| Function | Signature | Description |
|---|---|---|
destroy | () (**callable**) | Shuts down sockets and clears protocol tracking. |
init | () (**hook**) | Loads sub-modules and configures UDP sockets. |
isPhysicsStepUsed | () (**callable**) | True if any active protocol requires physics-frame updates. Returns physicsStepUsed. |
onPlayersChanged | (anyPlayerSeated) (**hook**) | Resets telemetry smoothers when occupancy changes. Returns M. |
reset | () (**hook**) | Resets all smoothers and sub-module states. |
settingsChanged | () (**hook**) | Re-initializes module on configuration updates. |
module.updateGFX | (dtSim) | Graphics-step update callback. Evaluates all active sub-protocols and transmits UDP packets. |
Usage Example
-- Protocols are configured via game settings (Options > Gameplay > Telemetry).
-- Enable OutGauge for SimHub or external dashboard apps:
-- Settings: outgaugeEnabled = true, outgaugeAddress = "127.0.0.1", outgaugePort = 4444
-- From Lua, protocols are managed automatically. Check if active:
if protocols.isPhysicsStepUsed() then
print("A telemetry protocol is using the physics step")
endProps Module Reference
Module defined in `lua/vehicle/props.lua`. Manages animated vehicle "props" (steering wheels, needles, shifters, etc.).
Recovery Module Reference
Module defined in `lua/vehicle/recovery.lua`. This module handles the vehicle's "Rewind" functionality, "Home" point management, and automatic repair logic. It maintains a historic log of vehicle posi