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 }
virtual void ParametersToLuaState(TConfigurationNode &t_tree)
The RNG.
Definition: rng.h:90
virtual void Reset()
Resets the state of the controller to what it was right after Init() was executed.
virtual void SensorReadingsToLuaState()
ticpp::Element TConfigurationNode
The ARGoS configuration XML node.
virtual void Init(TConfigurationNode &t_tree)
Initializes the controller.
std::string GetErrorMessage()
virtual void Destroy()
The default implementation of this method does nothing.
virtual void ControlStep()
Executes a control step.
virtual void CreateLuaState()
lua_State * GetLuaState()
The namespace containing all the ARGoS related code.
Definition: ci_actuator.h:12
The basic interface for a robot controller.
Definition: ci_controller.h:30
virtual void SetLuaScript(const std::string &str_script, TConfigurationNode &t_tree)