Robotsystem of the Robot Group Leipzig: Agent Class Reference

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Examples

- Search for |

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# 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:

[legend]
Collaboration diagram for Agent:

[legend]
List of all members.

## Public Member Functions
| Agent (const PlotOption &plotOption)
| constructor.
| Agent (const std::list< PlotOption > &plotOptions)
| 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 AbstractController * | getController ()
| Returns a pointer to the controller.
virtual AbstractRobot * | getRobot ()
| Returns a pointer to the robot.
virtual AbstractWiring * | getWiring ()
| 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
## 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
AbstractController * | controller
AbstractRobot * | robot
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
sensor * | rsensors
motor * | rmotors
sensor * | csensors
motor * | cmotors
TrackRobot | trackrobot

## 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 | ) |

constructor.

PlotOption an output setting.

Agent | ( | const std::list< PlotOption > & | plotOptions | ) |

constructor.

A list of PlotOption can begin. A PlotOption is an output setting.

~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 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.

## 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]`

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]`

TrackRobot trackrobot`[protected]`

AbstractWiring* wiring`[protected]`

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

- agent.h
- agent.cpp