lua_controller.h
Go to the documentation of this file.
1 
7 #include <argos3/core/control_interface/ci_controller.h>
8 #include <argos3/core/utility/math/rng.h>
9 
10 extern "C" {
11 #include <lua.h>
12 }
13 
14 namespace argos {
15 
16  class CLuaController : public CCI_Controller {
17 
18  public:
19 
21 
22  virtual ~CLuaController();
23 
24  virtual void Init(TConfigurationNode& t_tree);
25 
26  virtual void ControlStep();
27 
28  virtual void Reset();
29 
30  virtual void Destroy();
31 
32  inline lua_State* GetLuaState() {
33  return m_ptLuaState;
34  }
35 
36  virtual void SetLuaScript(const std::string& str_script,
37  TConfigurationNode& t_tree);
38 
39  virtual void SetLuaScript(const std::string& str_script);
40 
41  virtual void CreateLuaState();
42 
43  virtual void SensorReadingsToLuaState();
44 
45  virtual void ParametersToLuaState(TConfigurationNode& t_tree);
46 
47  inline bool IsOK() const {
48  return m_bIsOK;
49  }
50 
51  std::string GetErrorMessage();
52 
53  private:
54 
55  lua_State* m_ptLuaState;
56  std::string m_strScriptFileName;
57  bool m_bScriptActive;
58  bool m_bIsOK;
59  CRandom::CRNG* m_pcRNG;
60 
61  };
62 
63 }
The namespace containing all the ARGoS related code.
Definition: ci_actuator.h:12
ticpp::Element TConfigurationNode
The ARGoS configuration XML node.
The basic interface for a robot controller.
Definition: ci_controller.h:30
The RNG.
Definition: rng.h:90
virtual void SetLuaScript(const std::string &str_script, TConfigurationNode &t_tree)
virtual void ParametersToLuaState(TConfigurationNode &t_tree)
virtual void Destroy()
The default implementation of this method does nothing.
virtual void Init(TConfigurationNode &t_tree)
Initializes the controller.
std::string GetErrorMessage()
virtual void Reset()
Resets the state of the controller to what it was right after Init() was executed.
lua_State * GetLuaState()
virtual void ControlStep()
Executes a control step.
virtual void SensorReadingsToLuaState()
virtual void CreateLuaState()