Agent Class Reference

The Agent contains a controller, a robot and a wiring, which connects robot and controller. More...

#include <agent.h>

Inherited by OdeAgent.

Inheritance diagram for Agent:

Inheritance graph
[legend]
Collaboration diagram for Agent:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Agent (const PlotOption &plotOption=PlotOption(NoPlot), double noisefactor=1)
 constructor.
 Agent (const std::list< PlotOption > &plotOptions, double noisefactor=1)
 constructor.
virtual ~Agent ()
 destructor
virtual bool init (AbstractController *controller, AbstractRobot *robot, AbstractWiring *wiring)
 initializes the object with the given controller, robot and wiring and initializes the output options
virtual void step (double noise)
 Performs an step of the agent, including sensor reading, pushing sensor values through wiring, controller step, pushing controller outputs (= motorcommands) back through wiring and sent resulting motorcommands to robot.
virtual void onlyControlRobot ()
 Sends only last motor commands again to robot.
virtual AbstractControllergetController ()
 Returns a pointer to the controller.
virtual AbstractRobotgetRobot ()
 Returns a pointer to the robot.
virtual AbstractWiringgetWiring ()
 Returns a pointer to the wiring.
virtual void setTrackOptions (const TrackRobot &trackrobot)
 sets the trackoptions which enable tracking of a robot
virtual void addPlotOption (const 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 removePlotOption (PlotMode mode)
 removes the PlotOptions with the given type
virtual void writePlotComment (const char *cmt)
 write comment to output streams (PlotOptions).

Protected Member Functions

virtual void plot (const sensor *rx, int rsensornumber, const sensor *cx, int csensornumber, const motor *y, int motornumber)
 Plots controller sensor- and motorvalues and internal controller parameters.
void internInit ()

Protected Attributes

AbstractControllercontroller
AbstractRobotrobot
AbstractWiringwiring
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
sensorrsensors
motorrmotors
sensorcsensors
motorcmotors
TrackRobot trackrobot

Private Attributes

std::list< PlotOptionplotOptions
int t

Detailed Description

The Agent contains a controller, a robot and a wiring, which connects robot and controller.

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 visialisation tools like guilogger or neuronviz.

If want to log the position, speed and orienation of your robot you can use setTrackOptions().

Examples:

integration/main.cpp, and main.cpp.


Constructor & Destructor Documentation

Agent 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

Agent 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

~Agent  )  [virtual]
 

destructor


Member Function Documentation

void addPlotOption const 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 AbstractRobot* getRobot  )  [inline, virtual]
 

Returns a pointer to the robot.

Reimplemented in OdeAgent.

virtual AbstractWiring* getWiring  )  [inline, virtual]
 

Returns a pointer to the wiring.

bool init AbstractController controller,
AbstractRobot robot,
AbstractWiring wiring
[virtual]
 

initializes the object with the given controller, robot and wiring and initializes the output options

Examples:
integration/main.cpp, and main.cpp.

void internInit  )  [protected]
 

Reimplemented in OdeAgent.

void onlyControlRobot  )  [virtual]
 

Sends only last motor commands again to robot.

void plot const sensor rx,
int  rsensornumber,
const sensor cx,
int  csensornumber,
const motor y,
int  motornumber
[protected, virtual]
 

Plots controller sensor- and motorvalues and internal controller parameters.

Parameters:
rx actual sensorvalues from robot (used for generation of motorcommand in actual timestep)
rsensornumber length of rx
cx actual sensorvalues which are passed to controller (used for generation of motorcommand in actual timestep)
csensornumber length of cx
y actual motorcommand (generated in the actual timestep)
motornumber length of y

bool removePlotOption PlotMode  mode  )  [virtual]
 

removes the PlotOptions with the given type

Returns:
true if sucessful, false otherwise

void setTrackOptions const TrackRobot trackrobot  )  [virtual]
 

sets the trackoptions which enable tracking of a robot

void step double  noise  )  [virtual]
 

Performs an step of the agent, including sensor reading, pushing sensor values through wiring, controller step, pushing controller outputs (= motorcommands) back through wiring and sent resulting motorcommands to robot.

Parameters:
noise Noise strength.

Reimplemented in OdeAgent.

Examples:
integration/main.cpp, and main.cpp.

void writePlotComment const char *  cmt  )  [virtual]
 

write comment to output streams (PlotOptions).

For instance changes in parameters.


Member Data Documentation

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]
 

double noisefactor [protected]
 

factor that is muliplied with noise stength

std::list<PlotOption> plotOptions [private]
 

int rmotornumber [protected]
 

number of motors of robot

motor* rmotors [protected]
 

AbstractRobot* robot [protected]
 

int rsensornumber [protected]
 

number of sensors of robot

sensor* rsensors [protected]
 

int t [private]
 

TrackRobot trackrobot [protected]
 

AbstractWiring* wiring [protected]
 


The documentation for this class was generated from the following files:
Generated on Tue Jan 16 02:14:45 2007 for Robotsystem of the Robot Group Leipzig by doxygen 1.3.8