Skip to content

Data Gatherer

eisclimber edited this page Nov 3, 2024 · 4 revisions

Data Gatherer

class in ExPresSXR.Experimentation.DataGathering / Extends MonoBehavior
GameObject instantiable via GameObject/Data Gatherer

Description

The Data Gatherer is a component to extract and save data in a Unity Scene. All values that are specified in the Data Gatherer will be stored in a CSV-formatted file which will be saved at the path and/or be send via http POST to a server.

A more detailed description of the capabilities of the Data Gatherer can be found in the DataGathering-Tutorial which is also available in the editor under "ExPresS XR > Data Gathering".

Some important things to note:

  • The DataGatherer can automatically export values but any script can export new values at any time callingExportNewCsvLine().
  • When played in the editor the Values will be stored at Application.dataPath. The Build will store it at the apps data-path (e.g. %APPDATA% on Windows)
  • While includeTimestamp is optional it is recommended to include it as the export times might differ by a few milliseconds.
  • The shortest somewhat stable value for periodicExportTime was about 0.01s.
  • Using exportDuringUpdate the exports were around 0.02 on a Valve Index (aprox. Time.DeltaTime with 60FPs).

Members

Public Properties

  • string dataExportType: Whether the data should be exported to disk, via http or both.
  • char _columnSeparator = CsvUtility.DEFAULT_COLUMN_SEPARATOR: Separater used for separating CSV columns.
  • string localExportPath: If exporting to disk the path where the file is stored. If the file does not end with one of the following file extensions .txt, .log or .csv, they .csv wil be added per default. The values will usually be stored in a subfolder of the AppData-Folder to ensure writing privilege. To open it hit Window-Key + R, then enter %APPDATA%.
  • string httpExportPath: The URI a HTTP-post is sent to (requires a server listening to POSTs on that URI).
  • InputActionReference[] inputActionTrigger: An Array of InputAction of ActionType = Button that trigger an export.
  • bool exportDuringUpdate: If enabled, exports a new CSV line during FixedUpdate().
  • bool periodicExportEnabled: If enabled, exports a new CSV line every periodicExportTime seconds.
  • float periodicExportTime: Duration in between periodic exports in seconds, only if periodicExportTimeEnabled is set
  • bool includeTimeStamp: If enabled, adds an UNIX timestamp as first column to the CSV with column_name time. This is highly recommended when exporting time-critical or using short export intervals.
  • DataGatheringBinding[] dataBindings: The DataGatheringBindings that are specify which values of GameObjects are exported.
  • InputActionReference[] inputActionDataBindings: All InputActions that who's values are polled and exported. The name of the InputAction is used as column name.

Public Methods

  • void ExportNewCSVLine(): When called starts exporting a new csv line if possible.
  • string GetExportCSVLine(): Returns a CSV line with all specified values.
  • string GetExportCSVHeader(): Returns the CSV header for all specified values.
  • void ValidateBindings(): Validates all bindings and prints a warnings for all invalid DataGatheringBindings.
  • void AddNewBinding(DataGatheringBinding binding): Adds a DataGatheringBinding to the end of the exported Data Bindings. Use this function carefully as this rather expensive and it will not add a new column the header, if the file is already open.
  • public string GetLocalSavePath(): Returns the absolute (full) path to the file where the CSV should be saved.

Constants

  • string DEFAULT_EXPORT_FILE_NAME = "Data/DataGathererValues.csv": Default relative path to the saved file.
  • string UNIX_TIME_COLUMN_NAME = "unix_time": CSV column name for exporting unix time.
  • string UNITY_TIME_COLUMN_NAME = "unity_time": CSV column name for exporting unity time.
  • string DELTA_TIME_COLUMN_NAME = "delta_time": CSV column name for exporting delta time.

Enums

  • DataExportType: Used to specify how the CSV should be exported.

ExPresS XR Wiki

Tutorial Pages

Code Documentation

Clone this wiki locally