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

# WiredController Class Reference

The WiredController contains a controller and a wiring, which connects the controller with the robot. More...

`#include <wiredcontroller.h>`

Inherits Inspectable, and Configurable.

Inherited by Agent.

Collaboration diagram for WiredController:
[legend]

List of all members.

## Public Member Functions
| WiredController (const PlotOption &plotOption=PlotOption(NoPlot), double noisefactor=1, const iparamkey &name="WiredController", const paramkey &revision="$ID")
| constructor.
| WiredController (const std::list< PlotOption > &plotOptions, double noisefactor=1, const iparamkey &name="WiredController", const paramkey &revision="$ID")
| constructor.
virtual | ~WiredController ()
| destructor
virtual bool | init (AbstractController *controller, AbstractWiring *wiring, int robotsensornumber, int robotmotornumber, RandGen *randGen=0)
| initializes the object with the given controller and wiring and initializes the output options It is also possible to provide a random seed, if not given (0) rand() is used to create one
virtual void | step (const sensor *sensors, int sensornumber, motor *motors, int motornumber, double noise, double time=-1)
| Performs an step of the controller, which includes pushing sensor values through the wiring, controller step, pushing controller outputs (= motorcommands) back through the wiring.
virtual void | startMotorBabblingMode (int steps, AbstractController *babblecontroller=0, bool fixRobot=true)
| Enables the motor babbling mode for given number of steps (typically 1000).
virtual AbstractController * | getMotorBabbler ()
virtual void | stopMotorBabblingMode ()
| stops the motor babbling mode.
virtual bool | getMotorBabblingMode ()
| returns true if in motorbabbling mode
virtual PlotOption | addPlotOption (PlotOption &plotoption)
| adds the PlotOptions to the list of plotoptions If a plotoption with the same Mode exists, then the old one is deleted first
virtual bool | addAndInitPlotOption (PlotOption &plotOption)
| adds a new PlotOption and initializes it
virtual bool | removePlotOption (PlotMode mode)
| removes the PlotOptions with the given type
virtual void | writePlotComment (const char *cmt)
| write comment to output streams (PlotOptions).
virtual AbstractController * | getController ()
| Returns a pointer to the controller.
virtual const AbstractController * | getController () const
virtual AbstractWiring * | getWiring ()
| Returns a pointer to the wiring.
## Protected Member Functions
virtual void | plot (double time)
| Plots controller sensor- and motorvalues and internal controller parameters.
void | internInit ()
## Protected Attributes
AbstractController * | controller
AbstractWiring * | wiring
int | rsensornumber
| number of sensors of robot
int | rmotornumber
| number of motors of robot
int | csensornumber
| number of sensors of comntroller
int | cmotornumber
| number of motors of comntroller
double | noisefactor
| factor that is muliplied with noise stength
motor * | cmotors
sensor * | csensors
AbstractController * | motorBabbler
int | motorBabblingSteps
PlotOptionEngine | plotEngine
bool | initialised
std::list< Callbackable * > | callbackables
long int | t

## Detailed Description

The WiredController contains a controller and a wiring, which connects the controller with the robot.

Additionally there are some ways to keep track of internal information. You have the possibility to keep track of sensor values, motor values and internal parameters of the controller with PlotOptions. The name PlotOptions is a bit missleaded, it should be "OutputOptions", however you can write the data into a file or send it to visualisation tools like guilogger or neuronviz.

## Constructor & Destructor Documentation

WiredController | ( | const PlotOption & | plotOption = `PlotOption(NoPlot)`,
|  | double | noisefactor = `1`,
|  | const iparamkey & | name = `"WiredController"`,
|  | const paramkey & | revision = `"$ID"` |
| ) |  |  |

constructor.

PlotOption as output setting. noisefactor is used to set the relative noise strength of this agent

WiredController | ( | const std::list< PlotOption > & | plotOptions,
|  | double | noisefactor = `1`,
|  | const iparamkey & | name = `"WiredController"`,
|  | const paramkey & | revision = `"$ID"` |
| ) |  |  |

constructor.

A list of PlotOption can given. noisefactor is used to set the relative noise strength of this agent

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

destructor

## Member Function Documentation

bool addAndInitPlotOption | ( | PlotOption & | plotOption | ) | `[virtual]`

adds a new PlotOption and initializes it

See also:
  addPlotOption

PlotOption addPlotOption | ( | PlotOption & | plotoption | ) | `[virtual]`

adds the PlotOptions to the list of plotoptions If a plotoption with the same Mode exists, then the old one is deleted first

virtual const AbstractController* getController | ( |  | ) | const`[inline, virtual]`

virtual AbstractController* getController | ( |  | ) | `[inline, virtual]`

Returns a pointer to the controller.

virtual AbstractController* getMotorBabbler | ( |  | ) | `[inline, virtual]`

virtual bool getMotorBabblingMode | ( |  | ) | `[inline, virtual]`

returns true if in motorbabbling mode

virtual AbstractWiring* getWiring | ( |  | ) | `[inline, virtual]`

Returns a pointer to the wiring.

bool init | ( | AbstractController * | controller,
|  | AbstractWiring * | wiring,
|  | int | robotsensornumber,
|  | int | robotmotornumber,
|  | RandGen * | randGen = `0` |
| ) |  |  | `[virtual]`

initializes the object with the given controller and wiring and initializes the output options It is also possible to provide a random seed, if not given (0) rand() is used to create one

initializes the object with the given controller, robot and wiring

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

void plot | ( | double | time | ) | `[protected, virtual]`

Plots controller sensor- and motorvalues and internal controller parameters.

Parameters:

  | time | simulation time

bool removePlotOption | ( | PlotMode | mode | ) | `[virtual]`

removes the PlotOptions with the given type

Returns:
  true if sucessful, false otherwise

void startMotorBabblingMode | ( | int | steps,
|  | AbstractController * | babblecontroller = `0`,
|  | bool | fixRobot = `true` |
| ) |  |  | `[virtual]`

Enables the motor babbling mode for given number of steps (typically 1000).

Optionally a controller can be given that is used for the babbling (default is MotorBabbler) (deleted automatically). During motor babbling the function motorbabbling of the normal controller is called instead of step. The parameter fixRobot is intended for simulations

Reimplemented in OdeAgent.

void step | ( | const sensor * | sensors,
|  | int | sensornumber,
|  | motor * | motors,
|  | int | motornumber,
|  | double | noise,
|  | double | time = `-1` |
| ) |  |  | `[virtual]`

Performs an step of the controller, which includes pushing sensor values through the wiring, controller step, pushing controller outputs (= motorcommands) back through the wiring.

Parameters:

  | sensors | sensors inputs scaled to [-1,1]
  | sensornumber | length of the sensor array
  | motors | motors outputs. MUST have enough space for motor values!
  | motornumber | length of the provided motor array
  | noise | Noise strength.
  | time | (optional) current simulation time (used for logging)

virtual void stopMotorBabblingMode | ( |  | ) | `[inline, virtual]`

stops the motor babbling mode.

Reimplemented in OdeAgent.

void writePlotComment | ( | const char * | cmt | ) | `[virtual]`

write comment to output streams (PlotOptions).

For instance changes in parameters.

## Member Data Documentation

std::list<Callbackable* > callbackables`[protected]`

int cmotornumber`[protected]`

number of motors of comntroller

motor* cmotors`[protected]`

AbstractController* controller`[protected]`

int csensornumber`[protected]`

number of sensors of comntroller

sensor* csensors`[protected]`

bool initialised`[protected]`

AbstractController* motorBabbler`[protected]`

int motorBabblingSteps`[protected]`

double noisefactor`[protected]`

factor that is muliplied with noise stength

PlotOptionEngine plotEngine`[protected]`

int rmotornumber`[protected]`

number of motors of robot

int rsensornumber`[protected]`

number of sensors of robot

long int t`[protected]`

Reimplemented in Agent.

AbstractWiring* wiring`[protected]`

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

- wiredcontroller.h
- wiredcontroller.cpp