lobot::Experiment Class Reference

A class for storing all the relevant info from trajectory-related metrics logs. More...

#include <Robots/LoBot/metlog/LoExperiment.H>

Collaboration diagram for lobot::Experiment:
Collaboration graph
[legend]

List of all members.

Public Member Functions

std::string name () const
 Return this experiment's name.
int duration () const
void add_point (PointListName, int x, int y)
 This method adds a point to the named list.
void point_list (PointListName, const PointList &)
int size (PointListName) const
 This function returns the size of the named point list.
const PointListpoint_list (PointListName) const
void add_speed (float)
void speed_list (const std::vector< float > &)
const std::vector< float > & speed_list () const
bool save () const
void dump () const

void start_time (long long int t)
void finis_time (long long int t)

void add_trajectory (int x, int y)
void add_emergency_stop (int x, int y)
void add_extricate (int x, int y)
void add_lgmd_extricate (int x, int y)
void add_bump (int x, int y)

int trajectory_size () const
int emergency_stop_size () const
int extricate_size () const
int lgmd_extricate_size () const
int bump_size () const

void emergency_stop_stats (const istats &s)
void lrf_extricate_stats (const istats &s)
void lgmd_extricate_stats (const istats &s)
void total_extricate_stats (const istats &s)
void lgmd_success_stats (const fstats &s)
void extricate_success_stats (const fstats &s)
void duration_stats (const fstats &s)

Static Public Member Functions

static Experimentcreate (const std::string &name)

Detailed Description

A class for storing all the relevant info from trajectory-related metrics logs.

This class is used to hold all of the relevant data from a metlog and provide a convenient API for assisting with various number crunching tasks for the data analysis.

Definition at line 75 of file LoExperiment.H.


Member Function Documentation

void lobot::Experiment::add_point ( PointListName  n,
int  x,
int  y 
)

This method adds a point to the named list.

Definition at line 153 of file LoExperiment.C.

References add_trajectory().

void lobot::Experiment::add_speed ( float  speed  ) 

This method adds a speed reading to the list of speed readings subject to the condition that the speed actually represents a forward driving speed. This information is used to compute the average forward driving speed over the entire run.

This method is meant to be used by the metlog parsing module, i.e., with the lex-generated rules in LoMetlogParser.l.

Definition at line 207 of file LoExperiment.C.

void lobot::Experiment::add_trajectory ( int  x,
int  y 
) [inline]

These methods add trajectory info to their corresponding lists. They are meant to be used by the metlog parsing module, i.e., within the lex-generated rules in LoMetlogParser.l.

Definition at line 174 of file LoExperiment.H.

References lobot::PointList::add().

Referenced by add_point().

Experiment * lobot::Experiment::create ( const std::string name  )  [static]

This method can be used to create Experiment objects. This "named constructor" ensures that all instances of this class are created with the new operator and not as local objects on the stack.

Definition at line 127 of file LoExperiment.C.

void lobot::Experiment::dump (  )  const

Debugging support: dumps all the info to a file named dump-foo, where "foo" is actually the experiment's name, i.e., the same as the name of the log file from which this data object was created.

Definition at line 325 of file LoExperiment.C.

References duration(), and m_bump.

Referenced by lobot::Dataset::dump().

int lobot::Experiment::duration (  )  const [inline]

This function returns the duration of the experiment in milliseconds.

Definition at line 168 of file LoExperiment.H.

Referenced by dump().

void lobot::Experiment::emergency_stop_stats ( const istats s  )  [inline]

These functions record the means and standard deviations for various things such as the time-to-goal, number of extrication events, LGMD-based obstacle avoidance algorithm success rate, etc. These functions are meant to be used by the lomet main thread as part of the results computation (double duty, bad design, etc.; see comments appearing earlier).

NOTE: In addition to the means and standard deviations, we also record some other values such as the n and sum and sum of squares. These are useful for two-way ANOVA.

Definition at line 252 of file LoExperiment.H.

std::string lobot::Experiment::name (  )  const [inline]

Return this experiment's name.

Definition at line 149 of file LoExperiment.H.

const PointList & lobot::Experiment::point_list ( PointListName  n  )  const

This method returns the named point list.

NOTE: This method returns a reference to an internal data structure. Clients should consider the returned data structure read-only, i.e., they should refrain from casting away the constness of the returned object and doing nasty things to it.

Definition at line 240 of file LoExperiment.C.

References m_bump.

void lobot::Experiment::point_list ( PointListName  n,
const PointList L 
)

This method adds an entire point list to the one named by its parameter. It is meant to be used by the lomet program's main thread for building the result "experiment" from the analysis performed on the entire dataset.

Definition at line 178 of file LoExperiment.C.

References m_bump.

bool lobot::Experiment::save (  )  const

This method saves the experiment to a file whose name is the same as the experiment's name. It is meant to be called by the lomet main thread for saving the data analysis results.

It returns false to indicate that saving failed; this would happen if there is already an extant file that has the same name as this experiment. This feature ensures that metlogs loaded and parsed into an Experiment won't be overwritten if a client inadvertently calls this function. It also ensures that a previous result file won't be overwritten unless the user explicitly takes some action to allow the save to proceed, e.g., delete the old result file or reconfigure the program to save results to a differently named file.

Definition at line 287 of file LoExperiment.C.

References m_bump.

int lobot::Experiment::size ( PointListName  n  )  const

This function returns the size of the named point list.

Definition at line 222 of file LoExperiment.C.

References trajectory_size().

const std::vector<float>& lobot::Experiment::speed_list (  )  const [inline]

This function returns an std::vector of floats containing the speed readings recorded by this experiment.

WARNING: This function actually returns a const reference to an internal data structure. Yes, yes, bad design. Anyhoo, clients are advised/requested to treat the returned object as read-only.

Definition at line 239 of file LoExperiment.H.

void lobot::Experiment::speed_list ( const std::vector< float > &  speeds  ) 

This method adds all the speed readings in the given std::vector to this object's list of speed readings.

NOTE: This method is meant to be used by the lomet main thread for computing the final result, which is represented using an instance of this class. Yes, dreadful design. Ideally, we should have split the result related functionality into a separate class, viz., Result, which could have used private derivation from Experiment to take advantage of the functionality encapsulated here. Anyway, since the lomet program was originally conceived as a one-time, throwaway sort of thing, these shortcuts were deemed acceptable.

Definition at line 215 of file LoExperiment.C.

void lobot::Experiment::start_time ( long long int  t  )  [inline]

These methods record the times at which the experiment began and ended. These time stamps are expressed as the number of milliseconds elapsed since the Unix epoch.

These methods are meant to be used by the metlog parsing module, i.e., within the lex-generated rules in LoMetlogParser.l.

DEVNOTE: We use "finis" rather than "finish" because "finis" is the same length string as "start" and this makes code line up nicely (as can be seen with the definitions of these functions).

Definition at line 162 of file LoExperiment.H.

int lobot::Experiment::trajectory_size (  )  const [inline]

These functions return the sizes of the different point lists maintained by an experiment.

Definition at line 193 of file LoExperiment.H.

References lobot::PointList::size().

Referenced by size().


The documentation for this class was generated from the following files:
Generated on Sun May 8 08:30:42 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3