#include <wiredcontroller.h>
Inherits Inspectable, and BackCaller.
Inherited by Agent.
Inheritance diagram for WiredController:
Public Member Functions | |
WiredController (const PlotOption &plotOption=PlotOption(NoPlot), double noisefactor=1) | |
constructor. | |
WiredController (const std::list< PlotOption > &plotOptions, double noisefactor=1) | |
constructor. | |
virtual | ~WiredController () |
destructor | |
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 | |
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 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 | |
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 | addInspectable (const Inspectable *inspectable) |
adds an inspectable object for logging. | |
virtual void | addConfigurable (const Configurable *c) |
adds an configureable object for logging. | |
virtual void | writePlotComment (const char *cmt) |
write comment to output streams (PlotOptions). | |
virtual AbstractController * | getController () |
Returns a pointer to the controller. | |
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 |
PlotOptionEngine | plotEngine |
bool | initialised |
std::list< Callbackable * > | callbackables |
long int | t |
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.
WiredController | ( | const PlotOption & | plotOption = PlotOption(NoPlot) , |
|
double | noisefactor = 1 | |||
) |
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 | |||
) |
constructor.
A list of PlotOption can given. noisefactor is used to set the relative noise strength of this agent
~WiredController | ( | ) | [virtual] |
destructor
bool addAndInitPlotOption | ( | PlotOption & | plotOption | ) |
void addConfigurable | ( | const Configurable * | c | ) | [virtual] |
adds an configureable object for logging.
Must be called before init!
void addInspectable | ( | const Inspectable * | inspectable | ) | [virtual] |
adds an inspectable object for logging.
Must be called before init!
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 AbstractController* getController | ( | ) | [inline, virtual] |
Returns a pointer to the controller.
virtual AbstractWiring* getWiring | ( | ) | [inline, virtual] |
Returns a pointer to the wiring.
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
void internInit | ( | ) | [protected] |
Reimplemented in OdeAgent.
void plot | ( | double | time | ) | [protected, virtual] |
Plots controller sensor- and motorvalues and internal controller parameters.
time | simulation time |
bool removePlotOption | ( | PlotMode | mode | ) | [virtual] |
removes the PlotOptions with the given type
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.
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) |
void writePlotComment | ( | const char * | cmt | ) | [virtual] |
write comment to output streams (PlotOptions).
For instance changes in parameters.
std::list<Callbackable* > callbackables [protected] |
int cmotornumber [protected] |
number of motors of comntroller
AbstractController* controller [protected] |
int csensornumber [protected] |
number of sensors of comntroller
bool initialised [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
AbstractWiring* wiring [protected] |