Vehicle Stats Logger

Overview

The purpose of this extension is to facilitate logging of vehicle specific stats. The stats are organized in five modules:

  • inputs: gathers stats about user inputs to the vehicle (f.ex. steering, throttle, brake, etc.)
  • general: gathers stats not specific to any vehicle subsystem (f.ex. velocity, airspeed, position, altitude, etc.)
  • engine: gathers stats about the engine (f.ex. engine load, fuel state, stats about engine thermals, etc.)
  • powertrain: gathers stats about the powertrain (at the moment only whether the driveshaft is broken or not is logged)
  • wheels: gathers stats about the individual wheels (f.ex. tire volume, wheel speed, inertia, etc.) Once started, the logger will write the stats periodically to *.csv files in the output directory.

The Vehicle Stats Logger is usable either via the Lua API or as a UI app.

Note : The interested user can find more on the extensions here .

Usage

startLogging

startLogging()

Starts the logging. Beware that any data in the output directory from previous logging sessions may be overwritten. To minimize the impact on the game’s performance, the logger collects stats and flushes the information periodically to the output files.

stopLogging

stopLogging()

Flushes any remaining data to the output files and stops logging.

applySettingsFromJSON

applySettingsFromJSON(fpath)

Updates the the settings as specified in the given json file. The file is expected to be in the following location: C:\Users\<Your username>\AppData\Local\BeamNG.[drive,research]\<version number>\[fpath]

writeSettingsToJSON

writeSettingsToJSON(fpath)

Writes all available setings to a json file. The purpose of this functionality is to facilitate the acquisition of a valid template to adjust the options as needed. Depending on the executable used, the file can be found at the following location: C:\Users\<Your username>\AppData\Local\BeamNG.[drive,research]\<version number>\[fpath]

Example

The user can launch the Lua API and load the extension with

extensions.load("vehicleStatsLogger")

as in : Lua API Lua API. Then type

vehicleStatsLogger.startLogging()

to start data collection and

vehicleStatsLogger.stopLogging()

to end it. The data is saved in C:\Users\<Your username>\AppData\Local\BeamNG.[drive,research]\<version number>\VSL.

Structure

It is also possible to modify some settings directly through the modules variables. The module’s settings are structured as follows:

settings = {
    outputDir = "VSL",
    updatePeriod = 5,
    useModule = {
        Engine = true,
        General = true,
        Inputs = true,
        Powertrain = true,
        Wheels = true
    },
    ...
}

Thus, it is possible to quickly adjust the overall settings without using a json file for the respective vehicle:

extensions.vehicleStatsLogger.settings.outputDir = "VehicleNo7895"
extensions.vehicleStatsLogger.settings.updatePeriod = 10 
extensions.vehicleStatsLogger.settings.useModule.Wheels = false 

As this is an extension on the vehicle side, the above code examples needs to be executed in a vehicle’s lua VM.

App

Alternative to loading the extension manually, we also provide an app that supports the functionalities presented above. It is called Log Vehicle Stats (research) and can be found among BeamNG’s default apps. UI App UI App

Last modified: May 20, 2024

Any further questions?

Join our discord
Our documentation is currently incomplete and undergoing active development. If you have any questions or feedback, please visit this forum thread.