The Agent contains a controller, a robot and a wiring, which connects robot and controller. More...
#include <agent.h>
Inherits WiredController.
Inherited by OdeAgent.
Public Member Functions | |
Agent (const PlotOption &plotOption=PlotOption(NoPlot), double noisefactor=1, const iparamkey &name="Agent", const paramkey &revision="$ID") | |
constructor. | |
Agent (const std::list< PlotOption > &plotOptions, double noisefactor=1, const iparamkey &name="Agent", const paramkey &revision="$ID") | |
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 | |
Protected Attributes | |
AbstractRobot * | robot |
sensor * | rsensors |
motor * | rmotors |
RandGen | randGen |
TrackRobot | trackrobot |
int | t |
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.
Agent | ( | const PlotOption & | plotOption = PlotOption(NoPlot) , |
|
double | noisefactor = 1 , |
|||
const iparamkey & | name = "Agent" , |
|||
const paramkey & | revision = "$ID" | |||
) |
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 , |
|||
const iparamkey & | name = "Agent" , |
|||
const paramkey & | revision = "$ID" | |||
) |
constructor.
A list of PlotOption can given. noisefactor is used to set the relative noise strength of this agent
~Agent | ( | ) | [virtual] |
destructor
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
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
Reimplemented in OdeAgent.
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.
noise | Noise strength. | |
time | (optional) current simulation time (used for logging) |
Reimplemented in OdeAgent.
AbstractRobot* robot [protected] |
int t [protected] |
Reimplemented from WiredController.
TrackRobot trackrobot [protected] |