Logger Template
A template controller for data logging and telemetry recording. Demonstrates how to capture vehicle state data at regular intervals and output it for analysis. Copy this as a starting point for custom data loggers.
A template controller for data logging and telemetry recording. Demonstrates how to capture vehicle state data at regular intervals and output it for analysis. Copy this as a starting point for custom data loggers.
State Fields
| Field | Type | Description |
|---|---|---|
type | string | Keep as "auxiliary", there is also "main", but for logging purposes that would be the wrong choice |
defaultOrder | number | This determines when the controller update methods are executed relative to other controllers. If you have no specific requirements to that order, it's not relevant |
Public API
| Function | Description |
|---|---|
saveLogToCSV() | If you want to expose your own methods to the outside (for example for calling upon a key press) you need to list them here in the following format. There's an external and an internal name, the external is what the outside world sees, the internal is what your method in this file needs to be called like. (Both names can be the same) If this controller code is active (ie. specified in jbeam) you can call this method like this: controller.getController("loggerTemplate").saveLogToCSV() External name Internal name |
Hooks
| Hook | Description |
|---|---|
init() | This is called once when a vehicle is created |
reset() | This is being called once after the vehicle is created and then once everytime when the vehicle is reset |
updateGFX(dt) | This runs at a variable update rate matching the current FPS Example: The game runs at 60fps: Emthod is being called 60 times per second (and the dt variable is ~1/60 = 0.166667s) If you overload this method performance wise, fps will drop gracefully, so disk IO and other heavily unpredictable things are done/triggered from here (or user input) |
updateFixedStep(dt) | This runs at a fixed 100hz. (derived from 2000hz physics step, see note about performance on update()) |
update(dt) | This runs at a fixed 2000hz. Note: Fixed 2000hz means that there is ever only 0.0005s or 0.5ms of computing time available for all work. That includes all the raw physics, large parts of the powertrain, some parts of the safety and driving electronics, etc As soon as your computer takes more than the 0.5ms to process all these things, the game will not be able to compute things in time anymore and it will enter an automatic slow motion mode In practice this means that you should be very well aware of how performance sensitive your code is and avoid uunpredictable things like disk IO in anything that is/derives from the 2000hz update |
See Also
- Controller Template — General controller boilerplate
- Tech - Recorders — Built-in data recording system
Line Lock
Controls brake line locking valves that hold front brakes while releasing rears (or vice versa). Primarily used for drag racing burnouts — lock the front brakes to hold the car stationary while spinning the rear tires to heat them up.
Nitrous Oxide Injection
Controls nitrous oxide (NOS/N2O) injection systems that provide temporary power boosts by enriching the combustion mixture with additional oxygen. Manages bottle pressure, solenoid activation, fuel enrichment, and injection timing.