-
Notifications
You must be signed in to change notification settings - Fork 5
Working with experiment DataLoggers
Ricardo Garcia edited this page Jan 8, 2020
·
7 revisions
A DataLoggers handles logging experiment data to a 'csv' file. The default GameMaster already logs data automatically from all active sensors.
- Create data logger:
DataStreamLogger motionLogger = new DataStreamLogger("Motion"); - Add to ExperimentSystem to automatically configure:
ExperimentSystem.AddExperimentLogger(motionLogger);
- A new log file needs to be added whenever a log wants to be used.
- Add new file:
motionLogger.AddNewLogFile(session, iterationNumber, motionDataFormat);
-
Example of sensor reading and logging:
// Gather data while experiment is in progress string logData = taskTime.ToString(); // Read from all experiment sensors foreach (ISensor sensor in ExperimentSystem.GetActiveSensors()) { float[] sensorData = sensor.GetAllProcessedData(); foreach (float element in sensorData) logData += "," + element.ToString(); } // Update data and append taskTime += Time.fixedDeltaTime; // Log current data motionLogger.AppendData(logData);
- To be called when finished using a log.
motionLogger.CloseLog();