-
Notifications
You must be signed in to change notification settings - Fork 2
/
py_controller.h
72 lines (54 loc) · 1.59 KB
/
py_controller.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
* AUTHOR: Ken Hasselmann <arg AT kenh DOT fr>
*
* Connects ARGoS to python
*
*/
#ifndef PY_CONTROLLER_H
#define PY_CONTROLLER_H
#include <boost/make_shared.hpp>
#include "py_wrapper.h"
namespace argos {
class CPyController : public CCI_Controller {
public:
CPyController();
virtual ~CPyController() {}
/*
* This function initializes the controller.
* The 't_node' variable points to the <parameters> section in the XML
* file in the <controllers><footbot_ccw_wander_controller> section.
*/
virtual void Init(TConfigurationNode& t_node);
/*
* This function is called once every time step.
* The length of the time step is set in the XML file.
*/
virtual void ControlStep();
/*
* This function resets the controller to its state right after the
* Init().
* It is called when you press the reset button in the GUI.
* In this example controller there is no need for resetting anything,
* so the function could have been omitted. It's here just for
* completeness.
*/
virtual void Reset();
/*
* Called to cleanup what done by Init() when the experiment finishes.
* In this example controller there is no need for clean anything up,
* so the function could have been omitted. It's here just for
* completeness.
*/
virtual void Destroy();
void InitSensorsActuators(TConfigurationNode& t_node);
private:
boost::python::object m_main;
boost::python::object m_namesp;
boost::python::object m_script;
PyThreadState* m_interpreter;
boost::shared_ptr< ActusensorsWrapper > m_actusensors;
int m_state;
int m_id;
};
}
#endif