#include <discretecontrolleradapter.h>
Inherits AbstractControllerAdapter.
Inherited by Discretesizable.
Inheritance diagram for DiscreteControllerAdapter:
Public Member Functions | |
DiscreteControllerAdapter (AbstractController *controller) | |
Adapter class for robot controller. | |
virtual | ~DiscreteControllerAdapter () |
virtual void | setIntervalCount (int intervalCount) |
Sets the number of intervals, in which sensor AND motor values are mapped. | |
virtual void | setSensorIntervalCount (int sensorIntervalCount) |
Sets the number of intervals, in which sensor values are mapped. | |
virtual void | setMotorIntervalCount (int motorIntervalCount) |
Sets the number of intervals, in which motor values are mapped. | |
virtual void | setIntervalRange (double minRange, double maxRange, bool mapToInterval=true) |
Sets the interval range for the motors AND sensors, the minimum and maximum. | |
virtual void | setMotorIntervalRange (double minMotorRange, double maxMotorRange, bool mapToMotorInterval=true) |
Sets the interval range for the motors, the minimum and maximum. | |
virtual void | setSensorIntervalRange (double minSensorRange, double maxSensorRange, bool mapToSensorInterval=true) |
Sets the interval range for the sensors, the minimum and maximum. | |
virtual void | step (const sensor *sensors, int sensornumber, motor *motors, int motornumber) |
performs one step (includes learning). | |
virtual void | stepNoLearning (const sensor *, int number_sensors, motor *, int number_motors) |
performs one step without learning. | |
virtual void | init (int sensornumber, int motornumber, RandGen *randGen=0) |
init function | |
virtual std::list< Inspectable::iparamkey > | getInternalParamNames () const |
The list of the names of all internal parameters given by getInternalParams(). | |
virtual std::list< Inspectable::iparamval > | getInternalParams () const |
Protected Attributes | |
int | sensorIntervalCount |
int | motorIntervalCount |
bool | automaticMotorRange |
bool | automaticSensorRange |
bool | mapToSensorInterval |
bool | mapToMotorInterval |
double | minMotorRange |
double | maxMotorRange |
double | minSensorRange |
double | maxSensorRange |
The controller gets a number of input sensor values each timestep and has to generate a number of output motor values.
These sensor and motor values are discretesized with this adapter.
Use this adapter between an agent and a controller to get discrete sensor and motor values.
The sensor values are hand over to the controller from the agent, in the other direction the motor values of the controller are hand over to the agent.
If no intervalCount is set, the count=1. If no intervalRange is set, the range is automatically adjusted.
For more details about controllers, see AbstractController and all implementing classes.
DiscreteControllerAdapter | ( | AbstractController * | controller | ) |
Adapter class for robot controller.
The controller gets a number of input sensor values each timestep and has to generate a number of output motor values.
These sensor and motor values are discretesized with this adapter.
Use this adapter between an agent and a controller to get discrete sensor and motor values.
The sensor values are hand over to the controller from the agent, in the other direction the motor values of the controller are hand over to the agent.
For more details about controllers, see AbstractController and all implementing classes.
~DiscreteControllerAdapter | ( | ) | [virtual] |
std::list< Inspectable::iparamkey > getInternalParamNames | ( | ) | const [virtual] |
The list of the names of all internal parameters given by getInternalParams().
The naming convention is "v[i]" for vectors and "A[i][j]" for matrices, where i, j start at 0.
Reimplemented from AbstractControllerAdapter.
std::list< Inspectable::iparamval > getInternalParams | ( | ) | const [virtual] |
void init | ( | int | sensornumber, | |
int | motornumber, | |||
RandGen * | randGen = 0 | |||
) | [virtual] |
void setIntervalCount | ( | int | intervalCount | ) | [virtual] |
Sets the number of intervals, in which sensor AND motor values are mapped.
intervalCount | the number of intervals |
void setIntervalRange | ( | double | minRange, | |
double | maxRange, | |||
bool | mapToInterval = true | |||
) | [virtual] |
Sets the interval range for the motors AND sensors, the minimum and maximum.
The third parameter decides if the originally range should be completely mapped to the given interval range. If not, the values outside the given interval range are set to minRange respectively maxRange.
Note: The adjustment of the range is disabled, if this method is called.
minRange | the minimum of the interval | |
maxRange | the maximum of the interval | |
mapToInterval | decides if all values are mapped to the given interval |
void setMotorIntervalCount | ( | int | motorIntervalCount | ) | [virtual] |
Sets the number of intervals, in which motor values are mapped.
motorIntervalCount | the number of intervals |
void setMotorIntervalRange | ( | double | minMotorRange, | |
double | maxMotorRange, | |||
bool | mapToMotorInterval = true | |||
) | [virtual] |
Sets the interval range for the motors, the minimum and maximum.
The third parameter decides if the originally range should be completely mapped to the given interval range. If not, the values outside the given interval range are set to minMotorRange respectively maxMotorRange.
Note: The adjustment of the range is disabled, if this method is called.
minMotorRange | the minimum of the interval | |
maxMotorRange | the maximum of the interval | |
mapToMotorInterval | decides if all values are mapped to the given interval |
void setSensorIntervalCount | ( | int | sensorIntervalCount | ) | [virtual] |
Sets the number of intervals, in which sensor values are mapped.
sensorIntervalCount | the number of intervals |
void setSensorIntervalRange | ( | double | minSensorRange, | |
double | maxSensorRange, | |||
bool | mapToSensorInterval = true | |||
) | [virtual] |
Sets the interval range for the sensors, the minimum and maximum.
The third parameter decides if the originally range should be completely mapped to the given interval range. If not, the values outside the given interval range are set to minSensorRange respectively maxSensorRange.
Note: The adjustment of the range is disabled, if this method is called.
minSensorRange | the minimum of the interval | |
maxSensorRange | the maximum of the interval | |
mapToSensorInterval | decides if all values are mapped to the given interval |
performs one step (includes learning).
Calculates motor commands from sensor inputs.
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 |
Reimplemented from AbstractControllerAdapter.
Reimplemented in Discretesizable.
performs one step without learning.
Reimplemented from AbstractControllerAdapter.
Reimplemented in Discretesizable.
bool automaticMotorRange [protected] |
bool automaticSensorRange [protected] |
bool mapToMotorInterval [protected] |
bool mapToSensorInterval [protected] |
double maxMotorRange [protected] |
double maxSensorRange [protected] |
double minMotorRange [protected] |
double minSensorRange [protected] |
int motorIntervalCount [protected] |
int sensorIntervalCount [protected] |