argos::CLuaController Class Reference

#include <lua_controller.h>

Inheritance diagram for argos::CLuaController:
Collaboration diagram for argos::CLuaController:

Public Member Functions

 CLuaController ()
 
virtual ~CLuaController ()
 
virtual void Init (TConfigurationNode &t_tree)
 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...
 
lua_State * GetLuaState ()
 
virtual void SetLuaScript (const std::string &str_script, TConfigurationNode &t_tree)
 
virtual void SetLuaScript (const std::string &str_script)
 
virtual void CreateLuaState ()
 
virtual void SensorReadingsToLuaState ()
 
virtual void ParametersToLuaState (TConfigurationNode &t_tree)
 
bool IsOK () const
 
std::string GetErrorMessage ()
 
- Public Member Functions inherited from argos::CCI_Controller
virtual ~CCI_Controller ()
 Class destructor. 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::TMapGetAllActuators ()
 Returns a map of the associated actuators. More...
 
CCI_Sensor::TMapGetAllSensors ()
 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...
 

Additional Inherited Members

- Protected Attributes inherited from argos::CCI_Controller
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...
 

Detailed Description

Definition at line 16 of file lua_controller.h.

Constructor & Destructor Documentation

argos::CLuaController::CLuaController ( )

Definition at line 17 of file lua_controller.cpp.

argos::CLuaController::~CLuaController ( )
virtual

Definition at line 27 of file lua_controller.cpp.

Member Function Documentation

void argos::CLuaController::ControlStep ( )
virtual

Executes a control step.

The logic of your controller goes here. The default implementation does nothing.

Reimplemented from argos::CCI_Controller.

Definition at line 64 of file lua_controller.cpp.

void argos::CLuaController::CreateLuaState ( )
virtual

Definition at line 146 of file lua_controller.cpp.

void argos::CLuaController::Destroy ( )
virtual

The default implementation of this method does nothing.

See also
Init()
Reset()

Reimplemented from argos::CCI_Controller.

Definition at line 92 of file lua_controller.cpp.

std::string argos::CLuaController::GetErrorMessage ( )

Definition at line 212 of file lua_controller.cpp.

lua_State* argos::CLuaController::GetLuaState ( )
inline

Definition at line 32 of file lua_controller.h.

void argos::CLuaController::Init ( TConfigurationNode t_node)
virtual

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.

Parameters
t_nodeThe <params> XML tree associated to this controller.
See also
Reset()
Destroy()

Reimplemented from argos::CCI_Controller.

Definition at line 33 of file lua_controller.cpp.

bool argos::CLuaController::IsOK ( ) const
inline

Definition at line 47 of file lua_controller.h.

void argos::CLuaController::ParametersToLuaState ( TConfigurationNode t_tree)
virtual

Definition at line 191 of file lua_controller.cpp.

void argos::CLuaController::Reset ( )
virtual

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.

See also
Init()
Destroy()

Reimplemented from argos::CCI_Controller.

Definition at line 78 of file lua_controller.cpp.

void argos::CLuaController::SensorReadingsToLuaState ( )
virtual

Definition at line 175 of file lua_controller.cpp.

void argos::CLuaController::SetLuaScript ( const std::string &  str_script,
TConfigurationNode t_tree 
)
virtual

Definition at line 104 of file lua_controller.cpp.

void argos::CLuaController::SetLuaScript ( const std::string &  str_script)
virtual

Definition at line 138 of file lua_controller.cpp.