RcsPySim
A robot control and simulation library
Rcs::DataLogger Class Reference

#include <DataLogger.h>

Public Member Functions

 DataLogger ()
 
virtual ~DataLogger ()
 
void start (const BoxSpace *observationSpace, const BoxSpace *actionSpace, unsigned int maxStepCount)
 
void stop ()
 
void record (const MatNd *observation, const MatNd *action)
 
bool isRunning () const
 

Private Attributes

std::recursive_mutex mutex
 
unsigned int fileCounter
 
volatile bool running
 
MatNd * buffer
 
unsigned int currentStep
 
std::ofstream output
 

Detailed Description

Logs experiment data to a csv file. For every time step, it records the observations and the actions. The reward can be computed later on the Python side.

Definition at line 50 of file DataLogger.h.

Constructor & Destructor Documentation

◆ DataLogger()

Rcs::DataLogger::DataLogger ( )

Constructor. Automatically names files like TIME_FILENUM.csv on start

Definition at line 44 of file DataLogger.cpp.

◆ ~DataLogger()

Rcs::DataLogger::~DataLogger ( )
virtual

Definition at line 53 of file DataLogger.cpp.

Member Function Documentation

◆ isRunning()

bool Rcs::DataLogger::isRunning ( ) const
inline

Return true if running.

Definition at line 83 of file DataLogger.h.

◆ record()

void DataLogger::record ( const MatNd *  observation,
const MatNd *  action 
)

Record data for the current step.

Definition at line 129 of file DataLogger.cpp.

◆ start()

void Rcs::DataLogger::start ( const BoxSpace observationSpace,
const BoxSpace actionSpace,
unsigned int  maxStepCount 
)

Start logging for at most stepCount steps.

Parameters
[in]observationSpaceenvironment's observation space
[in]actionSpaceenvironment's action space
[in]maxStepCountmaximum number of time steps

Definition at line 59 of file DataLogger.cpp.

◆ stop()

void DataLogger::stop ( )

Stop logging and flush data to file.

Definition at line 97 of file DataLogger.cpp.

Member Data Documentation

◆ buffer

MatNd* Rcs::DataLogger::buffer
private

Buffer to avoid writing on realtime main thread.

Definition at line 98 of file DataLogger.h.

◆ currentStep

unsigned int Rcs::DataLogger::currentStep
private

Step counter in current logging run.

Definition at line 101 of file DataLogger.h.

◆ fileCounter

unsigned int Rcs::DataLogger::fileCounter
private

Automatic log file naming.

Definition at line 92 of file DataLogger.h.

◆ mutex

std::recursive_mutex Rcs::DataLogger::mutex
private

Definition at line 89 of file DataLogger.h.

◆ output

std::ofstream Rcs::DataLogger::output
private

Current output stream.

Definition at line 104 of file DataLogger.h.

◆ running

volatile bool Rcs::DataLogger::running
private

Flag if the logger is currently recording.

Definition at line 95 of file DataLogger.h.


The documentation for this class was generated from the following files: