Robot Simulator of the Robotics Group for Self-Organization of Control: DerivativeWiring Class Reference

# DerivativeWiring Class Reference

Implements a wiring (between controller and robot) which includes the first and second derivative of the original robot sensor values. More...

`#include <derivativewiring.h>`

Inherits AbstractWiring.

Collaboration diagram for DerivativeWiring:
[legend]

List of all members.

## Public Member Functions
| DerivativeWiring (const DerivativeWiringConf &conf, NoiseGenerator *noise, const std::string &name="DerivativeWiring")
| constructor
virtual | ~DerivativeWiring ()
| destructor
virtual void | reset ()
| reset internal state
## Static Public Member Functions
static DerivativeWiringConf | getDefaultConf ()
| Providing default configuration for DerivativeWiring with first derivative.
static DerivativeWiringConf | getDefaultConf1 ()
| Providing default configuration for DerivativeWiring for only first derivative.
## Protected Member Functions
virtual bool | initIntern ()
| to be overloaded by subclasses The rsensornumber and rmotornumber are already stored in the member variables.
virtual bool | wireSensorsIntern (const sensor *rsensors, int rsensornumber, sensor *csensors, int csensornumber, double noise)
| Realizes a wiring from robot sensors to controller sensors.
virtual bool | wireMotorsIntern (motor *rmotors, int rmotornumber, const motor *cmotors, int cmotornumber)
| Realizes wiring from controller motor outputs to robot motors.
void | calcFirstDerivative ()
| Calculate the first derivative of the sensorvalues given by the robot f'(x) = (f(x+1) - f(x-1)) / 2 since we do not have f(x+1) we go one timestep in the past.
void | calcSecondDerivative ()
| Calculate the secound derivative of the sensorvalues given by the robot f'(x) = f(x) - 2f(x-1) + f(x-2).
## Protected Attributes
DerivativeWiringConf | conf
| used configuration
int | time
sensor * | sensorbuffer [buffersize]
| number timesteps the sensor values are delayed for calculation of the derivative
sensor * | first
| current sensors (with noise)
sensor * | second
| current second derivative
motor * | blindMotors
| array that stored the values of the blind motors
## Static Protected Attributes
static const int | buffersize = 40

## Detailed Description

Implements a wiring (between controller and robot) which includes the first and second derivative of the original robot sensor values.

## Constructor & Destructor Documentation

DerivativeWiring | ( | const DerivativeWiringConf & | conf,
|  | NoiseGenerator * | noise,
|  | const std::string & | name = `"DerivativeWiring"` |
| ) |  |  |

constructor

Parameters:

  | conf | for giving the wished configuration of DerivativeWiring via DerivativeWiringConf
  | noise | NoiseGenerator that is used for adding noise to sensor values

~DerivativeWiring | ( |  | ) | `[virtual]`

destructor

## Member Function Documentation

void calcFirstDerivative | ( |  | ) | `[protected]`

Calculate the first derivative of the sensorvalues given by the robot f'(x) = (f(x+1) - f(x-1)) / 2 since we do not have f(x+1) we go one timestep in the past.

f'(x) = (f(x+1) - f(x-1)) / 2

void calcSecondDerivative | ( |  | ) | `[protected]`

Calculate the secound derivative of the sensorvalues given by the robot f'(x) = f(x) - 2f(x-1) + f(x-2).

f'(x) = f(x) - 2f(x-1) + f(x-2)

static DerivativeWiringConf getDefaultConf | ( |  | ) | `[inline, static]`

Providing default configuration for DerivativeWiring with first derivative.

No smoothing and no scaling. ( as static method )

static DerivativeWiringConf getDefaultConf1 | ( |  | ) | `[inline, static]`

Providing default configuration for DerivativeWiring for only first derivative.

smoothing over 4 steps and scale of 5. Use smaller noise! ( as static method )

bool initIntern | ( |  | ) | `[protected, virtual]`

to be overloaded by subclasses The rsensornumber and rmotornumber are already stored in the member variables.

The random values are to be accessed via the noiseGenerator.

See also:
  init()

Implements AbstractWiring.

void reset | ( |  | ) | `[virtual]`

reset internal state

Reimplemented from AbstractWiring.

bool wireMotorsIntern | ( | motor * | rmotors,
|  | int | rmotornumber,
|  | const motor * | cmotors,
|  | int | cmotornumber |
| ) |  |  | `[protected, virtual]`

Realizes wiring from controller motor outputs to robot motors.

Implements AbstractWiring.

bool wireSensorsIntern | ( | const sensor * | rsensors,
|  | int | rsensornumber,
|  | sensor * | csensors,
|  | int | csensornumber,
|  | double | noise |
| ) |  |  | `[protected, virtual]`

Realizes a wiring from robot sensors to controller sensors.

Implements AbstractWiring.

## Member Data Documentation

motor* blindMotors`[protected]`

array that stored the values of the blind motors

const int buffersize = 40`[static, protected]`

DerivativeWiringConf conf`[protected]`

used configuration

sensor* first`[protected]`

current sensors (with noise)

current first derivative

sensor* second`[protected]`

current second derivative

sensor* sensorbuffer[buffersize]`[protected]`

number timesteps the sensor values are delayed for calculation of the derivative

current and old smoothed sensor values of robot

int time`[protected]`

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

- derivativewiring.h
- derivativewiring.cpp