The basic interface for a robot controller. More...
#include <ci_controller.h>
Public Member Functions | |
virtual | ~CCI_Controller () |
Class destructor. More... | |
virtual void | Init (TConfigurationNode &t_node) |
Initializes the controller. More... | |
virtual void | ControlStep () |
Executes a control step. More... | |
virtual void | Reset () |
Resets the state of the controller to what it was right after Init() was executed. More... | |
virtual void | Destroy () |
The default implementation of this method does nothing. More... | |
const std::string & | GetId () const |
Returns the id of the robot associated to this controller. More... | |
void | SetId (const std::string &str_id) |
Sets the id of the robot associated to this controller. More... | |
template<typename ACTUATOR_IMPL > | |
ACTUATOR_IMPL * | GetActuator (const std::string &str_actuator_type) |
Returns a pointer to the an actuator, given its type. More... | |
template<typename SENSOR_IMPL > | |
SENSOR_IMPL * | GetSensor (const std::string &str_sensor_type) |
Returns a pointer to the an sensor, given its type. More... | |
bool | HasActuator (const std::string &str_actuator_type) const |
Returns true if an actuator with the passed type is associated to this controller. More... | |
bool | HasSensor (const std::string &str_sensor_type) const |
Returns true if an sensor with the passed type is associated to this controller. More... | |
CCI_Actuator::TMap & | GetAllActuators () |
Returns a map of the associated actuators. More... | |
CCI_Sensor::TMap & | GetAllSensors () |
Returns a map of the associated sensors. More... | |
void | AddActuator (const std::string &str_actuator_type, CCI_Actuator *pc_actuator) |
Adds an actuator to this controller. More... | |
void | AddSensor (const std::string &str_sensor_type, CCI_Sensor *pc_sensor) |
Adds an sensor to this controller. More... | |
Public Member Functions inherited from argos::CBaseConfigurableResource | |
virtual | ~CBaseConfigurableResource () |
Class destructor. More... | |
Protected Attributes | |
CCI_Actuator::TMap | m_mapActuators |
A map containing all the actuators associated to this controller. More... | |
CCI_Sensor::TMap | m_mapSensors |
A map containing all the sensors associated to this controller. More... | |
std::string | m_strId |
The id of the robot associated to this controller More... | |
The basic interface for a robot controller.
Definition at line 30 of file ci_controller.h.
|
virtual |
Class destructor.
Definition at line 14 of file ci_controller.cpp.
|
inline |
Adds an actuator to this controller.
This method is called internally by ARGoS. You should never call it in your controllers.
str_actuator_type | The type of the actuator to add. |
pc_actuator | A pointer to the actuator to add. |
Definition at line 193 of file ci_controller.h.
|
inline |
Adds an sensor to this controller.
This method is called internally by ARGoS. You should never call it in your controllers.
str_sensor_type | The type of the sensor to add. |
pc_sensor | A pointer to the sensor to add. |
Definition at line 205 of file ci_controller.h.
|
inlinevirtual |
Executes a control step.
The logic of your controller goes here. The default implementation does nothing.
Reimplemented in argos::CLuaController.
Definition at line 55 of file ci_controller.h.
|
inlinevirtual |
The default implementation of this method does nothing.
Implements argos::CBaseConfigurableResource.
Reimplemented in argos::CLuaController.
Definition at line 72 of file ci_controller.h.
|
inline |
Returns a pointer to the an actuator, given its type.
Internally, ARGoS creates an actuator object for each actuator listed in the <actuators>
section of the XML file. This method allows you to get a pointer to a specific actuator listed in the XML. The type corresponds to the XML tag of an actuator (not its implementation
attribute!).
str_actuator_type | The wanted actuator type. |
CARGoSException | if the actuator type was not found among those listed in the XML, or if the actual actuator object cannot be cast to the target class |
Definition at line 106 of file ci_controller.h.
|
inline |
Returns a map of the associated actuators.
Definition at line 174 of file ci_controller.h.
|
inline |
Returns a map of the associated sensors.
Definition at line 182 of file ci_controller.h.
|
inline |
Returns the id of the robot associated to this controller.
Definition at line 78 of file ci_controller.h.
|
inline |
Returns a pointer to the an sensor, given its type.
Internally, ARGoS creates an sensor object for each sensor listed in the <sensors>
section of the XML file. This method allows you to get a pointer to a specific sensor listed in the XML. The type corresponds to the XML tag of an sensor (not its implementation
attribute!).
str_sensor_type | The wanted sensor type. |
CARGoSException | if the sensor type was not found among those listed in the XML, or if the actual sensor object cannot be cast to the target class |
Definition at line 137 of file ci_controller.h.
bool argos::CCI_Controller::HasActuator | ( | const std::string & | str_actuator_type | ) | const |
Returns true
if an actuator with the passed type is associated to this controller.
str_actuator_type | The type of the wanted actuator. |
true
if an actuator with the passed type is associated to this controller. Definition at line 35 of file ci_controller.cpp.
bool argos::CCI_Controller::HasSensor | ( | const std::string & | str_sensor_type | ) | const |
Returns true
if an sensor with the passed type is associated to this controller.
str_sensor_type | The type of the wanted sensor. |
true
if an sensor with the passed type is associated to this controller. Definition at line 43 of file ci_controller.cpp.
|
inlinevirtual |
Initializes the controller.
You should always perform all your memory allocation and configuration in this method, and not in the constructor. The default implementation of this method does nothing.
t_node | The <params> XML tree associated to this controller. |
Implements argos::CBaseConfigurableResource.
Reimplemented in argos::CLuaController.
Definition at line 48 of file ci_controller.h.
|
inlinevirtual |
Resets the state of the controller to what it was right after Init() was executed.
Note that the state of the robot, as well as the state of sensors and actuators is automatically reset by ARGoS outside this class. The default implementation of this method does nothing.
Implements argos::CBaseConfigurableResource.
Reimplemented in argos::CLuaController.
Definition at line 65 of file ci_controller.h.
|
inline |
Sets the id of the robot associated to this controller.
It is used internally by ARGoS to set the robot id. You should never use this function inside your controller.
str_id | The new robot id. |
Definition at line 88 of file ci_controller.h.
|
protected |
A map containing all the actuators associated to this controller.
Definition at line 213 of file ci_controller.h.
|
protected |
A map containing all the sensors associated to this controller.
Definition at line 216 of file ci_controller.h.
|
protected |
The id of the robot associated to this controller
Definition at line 219 of file ci_controller.h.