Klamp't  0.8.1
PyController.h
1 #ifndef CONTROL_PY_CONTROLLER_H
2 #define CONTROL_PY_CONTROLLER_H
3 
4 #include "Controller.h"
5 
6 #if HAVE_PYTHON
7 #include "Python.h"
8 #else
9 typedef void PyObject;
10 #endif //HAVE_PYTHON
11 
38 {
39  public:
40  PyController(Robot& robot);
41  ~PyController();
42  bool Load(const string& moduleName);
43  void Unload();
44 
45  virtual const char* Type() const { return "PyController"; }
46  virtual void Update(Real dt);
47  virtual void Reset();
48  virtual bool ReadState(File& f);
49  virtual bool WriteState(File& f) const;
50 
51  virtual map<string,string> Settings() const;
52  virtual bool GetSetting(const string& name,string& str) const;
53  virtual bool SetSetting(const string& name,const string& str);
54 
55  virtual vector<string> Commands() const;
56  virtual bool SendCommand(const string& name,const string& str);
57 
58  string moduleName;
59  PyObject *module, *updateFunc, *resetFunc, *getStateFunc, *setStateFunc, *getSettingsFunc, *setSettingsFunc;
60  vector<string> commandFuncNames;
61  vector<PyObject*> commandFuncs;
62 };
63 
64 #endif
The main robot type used in RobotSim.
Definition: Robot.h:79
A base class for a robot controller. The base class does nothing.
Definition: Controller.h:27
A controller that interfaces with a python module.
Definition: PyController.h:37