Robot Simulator of the Robotics Group for Self-Organization of Control  0.8.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HUDStatisticsManager Class Reference

manages all the stuff displaying statistics on the graphics window. More...

#include <hudstatistics.h>

Inheritance diagram for HUDStatisticsManager:
Collaboration diagram for HUDStatisticsManager:

Classes

class  WindowStatistic
 Nested class WindowStatistic, which puts the measure and the graphics text together. More...
 

Public Member Functions

 HUDStatisticsManager (osg::Geode *geode, osgText::Font *font, int ypos)
 creates the HUDStatisticsManager, normally done by class Base. More...
 
virtual ~HUDStatisticsManager ()
 
virtual StatisticMeasuregetMeasure (double &observedValue, const char *measureName, MeasureMode mode, long stepSpan, double additionalParam=0)
 adds a variable to observe (on the window) and measure the value More...
 
virtual double & addMeasure (double &observedValue, const char *measureName, MeasureMode mode, long stepSpan, double additionalParam=0)
 adds a variable to observe (on the window) and measure the value More...
 
virtual double & addMeasure (AbstractMeasure *measure)
 You can add another abstract measure you like. More...
 
virtual double & addMeasureList (std::list< AbstractMeasure * > measureList)
 You can add another abstract measure you like. More...
 
virtual double & addMeasureList (std::list< ComplexMeasure * > measureList)
 You can add another abstract measure you like. More...
 
virtual double & addMeasureList (std::list< StatisticMeasure * > measureList)
 You can add another abstract measure you like. More...
 
virtual void beginMeasureAt (long step)
 starts the measure at a specific time. More...
 
virtual bool measureStarted ()
 Tells you wether the measures have already been started. More...
 
virtual void doOnCallBack (BackCaller *source, BackCaller::CallbackableType type=BackCaller::DEFAULT_CALLBACKABLE_TYPE)
 CALLBACKABLE INTERFACE. More...
 
virtual StatisticToolsgetStatisticTools ()
 
virtual WindowStatisticgetMeasureWS (const std::string &measureName)
 searches for the measure with the given name and returns it windowstatistics (measure and graphics together) More...
 
virtual void setColor (const Color &color)
 
virtual void setFontsize (int size)
 
- Public Member Functions inherited from Callbackable
 Callbackable ()
 
virtual ~Callbackable ()
 

Protected Attributes

std::list< WindowStatistic * > windowStatisticList
 the struct list which holds the measures and the appropiate text More...
 
StatisticToolsstatTool
 
float xInitPosition
 
float yInitPosition
 
float zInitPosition
 
float yOffset
 
osg::Geode * geode
 
osgText::Font * font
 
Color textColor
 
int fontsize
 

Detailed Description

manages all the stuff displaying statistics on the graphics window.

This is a experimental version, so do not to be afraid changing this crazy code.

This class uses the implementation of the class StatisticTools, which is generalized to make nice statistics. Instead of passing the values to the guilogger (INSPECTABLE interface), we simply diplay this values on the graphics window.

So how it works:

  • overwriting the method getMeasure gives us the ability to create the needed text object, then storing it in a class named WindowStatistic (which is stored in the windowStatisticList).

Constructor & Destructor Documentation

HUDStatisticsManager ( osg::Geode *  geode,
osgText::Font *  font,
int  ypos 
)

creates the HUDStatisticsManager, normally done by class Base.

Parameters
geodethis is the graphical node at wich the text objects are hooked in.
~HUDStatisticsManager ( )
virtual

Member Function Documentation

double & addMeasure ( double &  observedValue,
const char *  measureName,
MeasureMode  mode,
long  stepSpan,
double  additionalParam = 0 
)
virtual

adds a variable to observe (on the window) and measure the value

Parameters
observedValuethe value to observe.
measureNamethe name of the measured value
modethe mode of measure
stepSpanin most cases the stepSpan is important to get the measured value of a number of steps, like AVG: if stepSpan = 0, AVG is calculated over all steps if stepSpan = n, AVG is calculated over the LAST n steps The same counts for all the other MeasureModes.
additionalParamis used for example for mode PEAK, the param is the limit value, all values minus limit are displayed, values below the limit are set to 0. In CONV mode (test the convergence), this value is the epsilon criteria.
Returns
the object StatisticMeasure. Use addMeasure(...) instead of getMeasure(...) to obtain the value adress of the calculated statistic.
See Also
StatisticTools
StatisticMeasure
double & addMeasure ( AbstractMeasure measure)
virtual

You can add another abstract measure you like.

in some cases (e.g. complex measures) it is better to let the measure decide how it likes to be initialized

Parameters
measurethe measure to add
double & addMeasureList ( std::list< AbstractMeasure * >  measureList)
virtual

You can add another abstract measure you like.

in some cases (e.g. complex measures) it is better to let the measure decide how it likes to be initialized With this method you can add a list of AbstractMeasures.

Parameters
measureListthe list of measures to add
double & addMeasureList ( std::list< ComplexMeasure * >  measureList)
virtual

You can add another abstract measure you like.

in some cases (e.g. complex measures) it is better to let the measure decide how it likes to be initialized With this method you can add a list of AbstractMeasures.

Parameters
measureListthe list of measures to add
double & addMeasureList ( std::list< StatisticMeasure * >  measureList)
virtual

You can add another abstract measure you like.

in some cases (e.g. complex measures) it is better to let the measure decide how it likes to be initialized With this method you can add a list of AbstractMeasures.

Parameters
measureListthe list of measures to add
virtual void beginMeasureAt ( long  step)
inlinevirtual

starts the measure at a specific time.

This is useful if there are values that have to be ignored at simulation start.

Parameters
stepnumber of steps (normally simsteps) to wait for beginning the measures
void doOnCallBack ( BackCaller source,
BackCaller::CallbackableType  type = BackCaller::DEFAULT_CALLBACKABLE_TYPE 
)
virtual

CALLBACKABLE INTERFACE.

this method is invoked when a callback is done from the class where this class is for callback registered, it is overwritten

Implements Callbackable.

StatisticMeasure * getMeasure ( double &  observedValue,
const char *  measureName,
MeasureMode  mode,
long  stepSpan,
double  additionalParam = 0 
)
virtual

adds a variable to observe (on the window) and measure the value

Parameters
observedValuethe value to observe.
measureNamethe name of the measured value
modethe mode of measure
stepSpanin most cases the stepSpan is important to get the measured value of a number of steps, like AVG: if stepSpan = 0, AVG is calculated over all steps if stepSpan = n, AVG is calculated over the LAST n steps The same counts for all the other MeasureModes.
additionalParamis used for example for mode PEAK, the param is the limit value, all values minus limit are displayed, values below the limit are set to 0. In CONV mode (test the convergence), this value is the epsilon criteria.
Returns
the object StatisticMeasure. Use addMeasure(...) instead of getMeasure(...) to obtain the value adress of the calculated statistic.
See Also
StatisticTools
StatisticMeasure
HUDStatisticsManager::WindowStatistic * getMeasureWS ( const std::string &  measureName)
virtual

searches for the measure with the given name and returns it windowstatistics (measure and graphics together)

Returns
0 if not measure was found
virtual StatisticTools* getStatisticTools ( )
inlinevirtual
virtual bool measureStarted ( )
inlinevirtual

Tells you wether the measures have already been started.

virtual void setColor ( const Color color)
inlinevirtual
virtual void setFontsize ( int  size)
inlinevirtual

Member Data Documentation

osgText::Font* font
protected
int fontsize
protected
osg::Geode* geode
protected
StatisticTools* statTool
protected
Color textColor
protected
std::list<WindowStatistic*> windowStatisticList
protected

the struct list which holds the measures and the appropiate text

float xInitPosition
protected
float yInitPosition
protected
float yOffset
protected
float zInitPosition
protected

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