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
Discretisizer Class Reference

Use this class to get discrete values. More...

#include <discretisizer.h>

Public Member Functions

 Discretisizer (int numberBins)
 call this constructor if you don't like to decide which range for the values are used, therefore the range ist found automatically. More...
 
 Discretisizer (int numberBins, double minRange, double maxRange, bool mapToInterval)
 call this constructor if you like to decide yourself which range for the values are used. More...
 
virtual ~Discretisizer ()
 
virtual int getBinNumber (double value)
 returns the given value as an discretisized integer. More...
 
virtual double get (double value)
 returns the given value as an discretisized double. More...
 
virtual double getMinRange ()
 
virtual double getMaxRange ()
 

Protected Member Functions

virtual void findMinAndMaxRange (double value)
 is used for automaticRange, sets min and max range. More...
 
virtual void findMinAndMaxValues (double value)
 is used for mapToInterval, sets min and max values. More...
 
virtual int discretisizeValue (double valueToDiscretisize)
 is used for discretisizing values More...
 
virtual int roundValue (double valueToRound)
 

Protected Attributes

int numberBins
 
bool automaticRange
 
double minRange
 
double maxRange
 
double minValue
 
double maxValue
 
bool mapToInterval
 
bool firstStep
 

Detailed Description

Use this class to get discrete values.

If no intervalCount is set, the count=1. If no intervalRange is set, the range is automatically adjusted.

There are three possibilities:

  1. automaticRange=true –> mapping is always disabled
  2. automaticRange=false, mapToInterval=true –> real (found) range is mapped to specified range
  3. automaticRange=false, mapToInterval=false –> no mapping, no range adjustment, values outside the specified range are set to minRange respectively maxRange

Constructor & Destructor Documentation

Discretisizer ( int  numberBins)

call this constructor if you don't like to decide which range for the values are used, therefore the range ist found automatically.

Note: The adjustment of the range is enabled, if this method is called.

Parameters
numberBinsthe number of bins "created"
Discretisizer ( int  numberBins,
double  minRange,
double  maxRange,
bool  mapToInterval 
)

call this constructor if you like to decide yourself which range for the values are used.

The third parameter decides if the originally range should be completely mapped to the given interval range. If not, the values outside the given interval range are set to minRange respectively maxRange.

Note: The adjustment of the range is disabled, if this method is called.

Parameters
numberBinsthe number of bins "created"
minRangethe minimum of the interval
maxRangethe maximum of the interval
mapToIntervaldecides if all values are mapped to the given
~Discretisizer ( )
virtual

Member Function Documentation

int discretisizeValue ( double  valueToDiscretisize)
protectedvirtual

is used for discretisizing values

void findMinAndMaxRange ( double  value)
protectedvirtual

is used for automaticRange, sets min and max range.

void findMinAndMaxValues ( double  value)
protectedvirtual

is used for mapToInterval, sets min and max values.

double get ( double  value)
virtual

returns the given value as an discretisized double.

this method returns returns a value between minRange and maxRange

Parameters
valuethe value to discretisize
Returns
discretisized value between minRange and maxRange
int getBinNumber ( double  value)
virtual

returns the given value as an discretisized integer.

this method returns a value between 0...numberbins-1.

Parameters
valuethe value to discretisize
Returns
the bin number
double getMaxRange ( )
virtual
double getMinRange ( )
virtual
int roundValue ( double  valueToRound)
protectedvirtual

Member Data Documentation

bool automaticRange
protected
bool firstStep
protected
bool mapToInterval
protected
double maxRange
protected
double maxValue
protected
double minRange
protected
double minValue
protected
int numberBins
protected

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