Robotsystem of the Robot Group Leipzig: Agent Class Reference

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages
- 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>`

Inherits WiredController.

Inherited by OdeAgent.

Inheritance diagram for Agent:

[legend]
Collaboration diagram for Agent:

[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, long int seed=0)
| initializes the object with the given controller, robot and wiring and initializes the output options.
virtual void | step (double noise, double time=-1)
| Performs an step of the agent, including sensor reading, pushing sensor values through the wiring, controller step, pushing controller outputs (= motorcommands) back through the wiring and sent resulting motorcommands to robot.
virtual void | onlyControlRobot ()
| Sends only last motor commands again to robot.
virtual AbstractRobot * | getRobot ()
| Returns a pointer to the robot.
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 (overwritten from WiredController, to add robot)
## Protected Attributes
AbstractRobot * | robot
sensor * | rsensors
motor * | rmotors
RandGen | randGen
TrackRobot | trackrobot
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(). Please be aware that the Agent inherits from WiredController. You might also find useful functions there.

Examples:

  integration/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 (overwritten from WiredController, to add robot)

Reimplemented from WiredController.

virtual AbstractRobot* getRobot | ( |  | ) | `[inline, virtual]`

Returns a pointer to the robot.

Reimplemented in OdeAgent.

bool init | ( | AbstractController * | controller,
|  | AbstractRobot * | robot,
|  | AbstractWiring * | wiring,
|  | long int | seed = `0` |
| ) |  |  | `[virtual]`

initializes the object with the given controller, robot 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

Examples:
  integration/main.cpp.

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

Sends only last motor commands again to robot.

void setTrackOptions | ( | const TrackRobot & | trackrobot | ) | `[virtual]`

sets the trackoptions which enable tracking of a robot

void step | ( | double | noise,
|  | double | time = `-1` |
| ) |  |  | `[virtual]`

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

Parameters:

  | noise | Noise strength.
  | time | (optional) current simulation time (used for logging)

Reimplemented in OdeAgent.

Examples:
  integration/main.cpp.

## Member Data Documentation

RandGen randGen`[protected]`

motor* rmotors`[protected]`

AbstractRobot* robot`[protected]`

sensor* rsensors`[protected]`

int t`[protected]`

Reimplemented from WiredController.

TrackRobot trackrobot`[protected]`

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

- agent.h
- agent.cpp