-
Notifications
You must be signed in to change notification settings - Fork 2
/
py_wrapper.cpp
439 lines (386 loc) · 21.4 KB
/
py_wrapper.cpp
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
/*
* AUTHOR: Ken Hasselmann <arg AT kenh DOT fr>
*
* Connects ARGoS to python
*
*/
#include "py_wrapper.h"
using namespace argos;
using namespace boost::python;
ActusensorsWrapper::ActusensorsWrapper()
{
}
/****************************************/
/****************************************/
void ActusensorsWrapper::Logprint(const std::string str_message)
{
std::cout << str_message << std::endl;
}
/****************************************/
/****************************************/
// Initialize the actuator specified by the provided name.
// NOTE: the Init function gives problems for all the sensors/actuators that use the "media" parameter.
// When the argos file is loaded, the following error is given:
// [FATAL] Error parsing attribute "medium"
// Attribute does not exist <ticpp.h@1791>
// The sensors/actuators seem to work even without it, so for now it has been disabled.
void ActusensorsWrapper::CreateActu(const std::string str_name, CCI_Actuator *pc_actu, TConfigurationNode &t_node)
{
if (str_name == "differential_steering")
{
m_cWheelsWrapper.m_pcWheels = (CCI_DifferentialSteeringActuator *)pc_actu;
m_cWheelsWrapper.m_bWheels = true;
m_cWheelsWrapper.m_pcWheels->Init(t_node);
}
if (str_name == "footbot_gripper")
{
m_cGripperWrapper.m_pcGripper = dynamic_cast<CCI_FootBotGripperActuator *>(pc_actu);
m_cGripperWrapper.m_bGripper = true;
m_cGripperWrapper.m_pcGripper->Init(t_node);
}
if (str_name == "leds")
{
m_cLedsWrapper.m_pcLeds = (CCI_LEDsActuator *)pc_actu;
m_cLedsWrapper.m_bLeds = true;
//m_cLedsWrapper.m_pcLeds->Init(t_node);
}
if (str_name == "range_and_bearing")
{
m_cRangeAndBearingWrapper.m_pcRABA = (CCI_RangeAndBearingActuator *)pc_actu;
m_cRangeAndBearingWrapper.m_bRABA = true;
//m_cRangeAndBearingWrapper.m_pcRABA->Init(t_node);
}
if (str_name == "footbot_distance_scanner")
{
m_cDistanceScannerWrapper.m_pcScannerActuator = dynamic_cast<CCI_FootBotDistanceScannerActuator *>(pc_actu);
m_cDistanceScannerWrapper.m_bScannerActuator = true;
m_cDistanceScannerWrapper.m_pcScannerActuator->Init(t_node);
}
if (str_name == "footbot_turret")
{
m_cTurretWrapper.m_pcTurretActuator = dynamic_cast<CCI_FootBotTurretActuator *>(pc_actu);
m_cTurretWrapper.m_bTurretActuator = true;
m_cTurretWrapper.m_pcTurretActuator->Init(t_node);
}
// E-Puck actuators.
if (str_name == "epuck_wheels")
{
m_cEPuckWheelsWrapper.m_pcEPuckWheels = dynamic_cast<CCI_EPuckWheelsActuator *>(pc_actu);
m_cEPuckWheelsWrapper.m_bEPuckWheels = true;
m_cEPuckWheelsWrapper.m_pcEPuckWheels->Init(t_node);
}
if (str_name == "epuck_range_and_bearing")
{
m_cEPuckRangeAndBearingWrapper.m_pcEPuckRABA = (CCI_EPuckRangeAndBearingActuator *)pc_actu;
m_cEPuckRangeAndBearingWrapper.m_bEPuckRABA = true;
//m_cRangeAndBearingWrapper.m_pcRABA->Init(t_node);
}
if (str_name == "epuck_rgb_leds")
{
m_cEPuckLedsWrapper.m_pcEPuckLeds = (CCI_EPuckRGBLEDsActuator *)pc_actu;
m_cEPuckLedsWrapper.m_bEPuckLeds = true;
//m_cLedsWrapper.m_pcLeds->Init(t_node);
}
}
/****************************************/
/****************************************/
// Initialize the sensor specified by the provided name.
void ActusensorsWrapper::CreateSensor(const std::string str_name, CCI_Sensor *pc_sensor, TConfigurationNode &t_node)
{
if (str_name == "footbot_proximity")
{
m_cProximitySensorWrapper.m_pcProximity = (CCI_FootBotProximitySensor *)pc_sensor;
m_cProximitySensorWrapper.m_bProximity = true;
m_cProximitySensorWrapper.m_pcProximity->Init(t_node);
}
if (str_name == "colored_blob_omnidirectional_camera")
{
m_cOmnidirectionalCameraWrapper.m_pcOmniCam = (CCI_ColoredBlobOmnidirectionalCameraSensor *)pc_sensor;
m_cOmnidirectionalCameraWrapper.m_bOmniCam = true;
//m_cOmnidirectionalCameraWrapper.m_pcOmniCam->Init(t_node);
}
if (str_name == "range_and_bearing")
{
m_cRangeAndBearingWrapper.m_pcRABS = (CCI_RangeAndBearingSensor *)pc_sensor;
m_cRangeAndBearingWrapper.m_bRABS = true;
//m_cRangeAndBearingWrapper.m_pcRABS->Init(t_node);
}
if (str_name == "footbot_motor_ground")
{
m_cGroundSensorWrapper.m_pcGround = (CCI_FootBotMotorGroundSensor *)pc_sensor;
m_cGroundSensorWrapper.m_bGround = true;
m_cGroundSensorWrapper.m_pcGround->Init(t_node);
}
if (str_name == "footbot_base_ground")
{
m_cBaseGroundSensorWrapper.m_pcBaseGround = dynamic_cast<CCI_FootBotBaseGroundSensor *>(pc_sensor);
m_cBaseGroundSensorWrapper.m_bBaseGround = true;
m_cBaseGroundSensorWrapper.m_pcBaseGround->Init(t_node);
}
if (str_name == "footbot_light")
{
m_cLightSensorWrapper.m_pcLight = (CCI_FootBotLightSensor *)pc_sensor;
m_cLightSensorWrapper.m_bLight = true;
m_cLightSensorWrapper.m_pcLight->Init(t_node);
}
if (str_name == "footbot_distance_scanner")
{
m_cDistanceScannerWrapper.m_pcScannerSensor = (CCI_FootBotDistanceScannerSensor *)pc_sensor;
m_cDistanceScannerWrapper.m_bScannerSensor = true;
m_cDistanceScannerWrapper.m_pcScannerSensor->Init(t_node);
}
if (str_name == "footbot_turret_encoder")
{
m_cTurretWrapper.m_pcTurretSensor = dynamic_cast<CCI_FootBotTurretEncoderSensor *>(pc_sensor);
m_cTurretWrapper.m_bTurretSensor = true;
m_cTurretWrapper.m_pcTurretSensor->Init(t_node);
}
if (str_name == "epuck_proximity")
{
m_cEPuckProximitySensorWrapper.m_pcEPuckProximity = dynamic_cast<CCI_EPuckProximitySensor *>(pc_sensor);
m_cEPuckProximitySensorWrapper.m_bEPuckProximity = true;
m_cEPuckProximitySensorWrapper.m_pcEPuckProximity->Init(t_node);
}
if (str_name == "epuck_ground")
{
m_cEPuckGroundSensorWrapper.m_pcEPuckGround = dynamic_cast<CCI_EPuckGroundSensor *>(pc_sensor);
m_cEPuckGroundSensorWrapper.m_bEPuckGround = true;
m_cEPuckGroundSensorWrapper.m_pcEPuckGround->Init(t_node);
}
if (str_name == "epuck_range_and_bearing")
{
m_cEPuckRangeAndBearingWrapper.m_pcEPuckRABS = (CCI_EPuckRangeAndBearingSensor *)pc_sensor;
m_cEPuckRangeAndBearingWrapper.m_bEPuckRABS = true;
//m_cRangeAndBearingWrapper.m_pcRABA->Init(t_node);
}
}
/****************************************/
/****************************************/
// Create a color by providing its name.
ActusensorsWrapper::CColorWrapper::CColorWrapper(const std::string str_color_name)
{
if (str_color_name == "red")
m_cColor = argos::CColor::RED;
else if (str_color_name == "black")
m_cColor = argos::CColor::BLACK;
// TODO: more colors
}
// Create a color by providing its RGB values.
ActusensorsWrapper::CColorWrapper::CColorWrapper(const UInt8 un_red, const UInt8 un_green, const UInt8 un_blue)
{
m_cColor = argos::CColor((const UInt8)un_red, (const UInt8)un_green, (const UInt8)un_blue, 0);
}
/****************************************/
/****************************************/
void ActusensorsWrapper::CByteArraySetItem(argos::CByteArray &c_vec, const UInt32 un_index, const UInt8 un_value)
{
if (un_index >= 0 && un_index < c_vec.Size())
{
c_vec[un_index] = un_value;
}
else
{
PyErr_SetString(PyExc_IndexError, "index out of range");
boost::python::throw_error_already_set();
}
}
UInt8 ActusensorsWrapper::CByteArrayGetItem(const argos::CByteArray &c_vec, const UInt32 un_index)
{
if (un_index >= 0 && un_index < c_vec.Size())
{
return c_vec[un_index];
}
else
{
PyErr_SetString(PyExc_IndexError, "index out of range");
boost::python::throw_error_already_set();
}
}
Real ActusensorsWrapper::EPuckGroundReadingsGetItem(const argos::CCI_EPuckGroundSensor::SReadings &c_readings, const UInt32 un_index)
{
if (un_index >= 0 && un_index < 3)
{
return c_readings[un_index];
}
else
{
PyErr_SetString(PyExc_IndexError, "index out of range");
boost::python::throw_error_already_set();
}
}
/****************************************/
/****************************************/
BOOST_PYTHON_MODULE(libpy_controller_interface)
{
// Export the main "robot" class, and define the various actuators and sensors as property of the class.
class_<ActusensorsWrapper, boost::shared_ptr<ActusensorsWrapper>, boost::noncopyable>("robot", no_init)
.def("logprint", &ActusensorsWrapper::Logprint)
.staticmethod("logprint")
.add_property("wheels", &ActusensorsWrapper::m_cWheelsWrapper)
.add_property("colored_blob_omnidirectional_camera", &ActusensorsWrapper::m_cOmnidirectionalCameraWrapper)
.add_property("proximity", &ActusensorsWrapper::m_cProximitySensorWrapper)
.add_property("leds", &ActusensorsWrapper::m_cLedsWrapper)
.add_property("range_and_bearing", &ActusensorsWrapper::m_cRangeAndBearingWrapper)
.add_property("motor_ground", &ActusensorsWrapper::m_cGroundSensorWrapper)
.add_property("base_ground", &ActusensorsWrapper::m_cBaseGroundSensorWrapper)
.add_property("gripper", &ActusensorsWrapper::m_cGripperWrapper)
.add_property("light_sensor", &ActusensorsWrapper::m_cLightSensorWrapper)
.add_property("distance_scanner", &ActusensorsWrapper::m_cDistanceScannerWrapper)
.add_property("turret", &ActusensorsWrapper::m_cTurretWrapper)
.add_property("epuck_wheels", &ActusensorsWrapper::m_cEPuckWheelsWrapper)
.add_property("epuck_proximity", &ActusensorsWrapper::m_cEPuckProximitySensorWrapper)
.add_property("epuck_ground", &ActusensorsWrapper::m_cEPuckGroundSensorWrapper)
.add_property("epuck_range_and_bearing", &ActusensorsWrapper::m_cEPuckRangeAndBearingWrapper)
.add_property("epuck_leds", &ActusensorsWrapper::m_cEPuckLedsWrapper);
// Export "WheelsWrapper", wrapper of CCI_DifferentialSteeringActuator.
class_<CWheelsWrapper, boost::noncopyable>("wheels_wrapper", no_init)
.def("set_speed", &CWheelsWrapper::SetSpeed);
// Export "EPuckWheelsWrapper", wrapper of CCI_EPuckWheelsActuator.
class_<CEPuckWheelsWrapper, boost::noncopyable>("epuck_wheels_wrapper", no_init)
.def("set_speed", &CEPuckWheelsWrapper::SetSpeed);
// Export "GripperWrapper", wrapper of CFootBotGripping.
class_<CGripperWrapper, boost::noncopyable>("m_cGripperWrapper", no_init)
.def("lock", &CGripperWrapper::Lock)
.def("unlock", &CGripperWrapper::Unlock);
// Export "OmnidirectionalCameraWrapper" , wrapper of CCI_ColoredBlobOmnidirectionalCameraSensor.
class_<COmnidirectionalCameraWrapper, boost::noncopyable>("omnidirectional_camera_wrapper", no_init)
.def("enable", &COmnidirectionalCameraWrapper::Enable)
.def("disable", &COmnidirectionalCameraWrapper::Disable)
.def("get_readings", &COmnidirectionalCameraWrapper::GetReadings)
.def("get_counter", &COmnidirectionalCameraWrapper::GetCounter);
// Export "FootBotProximitySensorWrapper", wrapper of CCI_FootBotProximitySensor.
class_<CFootBotProximitySensorWrapper, boost::noncopyable>("footbot_proximity_sensor_wrapper", no_init)
.def("get_readings", &CFootBotProximitySensorWrapper::GetReadings);
// Export "CEPuckProximitySensorWrapper", wrapper of CCI_EPuckProximitySensor.
class_<CEPuckProximitySensorWrapper, boost::noncopyable>("epuck_proximity_sensor_wrapper", no_init)
.def("get_readings", &CEPuckProximitySensorWrapper::GetReadings);
// Export "LedsActuatorWrapper", wrapper of CCI_LEDsActuator.
class_<CLedsActuatorWrapper, boost::noncopyable>("leds_actuator_wrapper", no_init)
.def("set_single_color", &CLedsActuatorWrapper::SetSingleColorString)
.def("set_single_color", &CLedsActuatorWrapper::SetSingleColorRGB)
.def("set_all_colors", &CLedsActuatorWrapper::SetAllColorsString)
.def("set_all_colors", &CLedsActuatorWrapper::SetAllColorsRGB);
// Export "EPuckLedsActuatorWrapper", wrapper of CCI_EPuckRGBLEDsActuator.
class_<CEPuckLedsActuatorWrapper, boost::noncopyable>("epuck_leds_actuator_wrapper", no_init)
.def("set_single_color", &CEPuckLedsActuatorWrapper::SetSingleColorString)
.def("set_single_color", &CEPuckLedsActuatorWrapper::SetSingleColorRGB)
.def("set_all_colors", &CEPuckLedsActuatorWrapper::SetAllColorsString)
.def("set_all_colors", &CEPuckLedsActuatorWrapper::SetAllColorsRGB);
// Export RangeAndBearingWrapper, wrapper of CCI_RangeAndBearingActuator and CCI_RangeAndBearingSensor.
class_<CRangeAndBearingWrapper, boost::noncopyable>("m_cRangeAndBearingWrapper", no_init)
.def("clear_data", &CRangeAndBearingWrapper::ClearData)
.def("set_data", &CRangeAndBearingWrapper::SetData)
.def("get_readings", &CRangeAndBearingWrapper::GetReadings);
// Export RangeAndBearingWrapper, wrapper of CCI_RangeAndBearingActuator and CCI_RangeAndBearingSensor.
class_<CEPuckRangeAndBearingWrapper, boost::noncopyable>("m_cEPuckRangeAndBearingWrapper", no_init)
.def("clear_data", &CEPuckRangeAndBearingWrapper::ClearPackets)
.def("set_data", &CEPuckRangeAndBearingWrapper::SetData)
.def("get_readings", &CEPuckRangeAndBearingWrapper::GetPackets);
// Export GroundSensorWrapper, wrapper of CCI_FootBotMotorGroundSensor.
class_<CGroundSensorWrapper, boost::noncopyable>("m_cGroundSensorWrapper", no_init)
.def("get_readings", &CGroundSensorWrapper::GetReadings);
// Export BaseGroundSensorWrapper, wrapper of CCI_FootBotBaseGroundSensor .
class_<CBaseGroundSensorWrapper, boost::noncopyable>("m_cBaseGroundSensorWrapper", no_init)
.def("get_readings", &CBaseGroundSensorWrapper::GetReadings);
// Export EPuckGroundSensorWrapper, wrapper of CCI_EPuckGroundSensor .
class_<CEPuckGroundSensorWrapper, boost::noncopyable>("m_cEPuckGroundSensorWrapper", no_init)
.def("get_readings", &CEPuckGroundSensorWrapper::GetReadings);
// Export LightSensorWrapper, wrapper of CCI_FootBotLightSensor.
class_<CLightSensorWrapper, boost::noncopyable>("m_cLightSensorWrapper", no_init)
.def("get_readings", &CLightSensorWrapper::GetReadings);
// Export DistanceScannerWrapper, wrapper of CCI_FootBotDistanceScannerActuator and CCI_FootBotDistanceScannerSensor.
class_<CDistanceScannerWrapper, boost::noncopyable>("m_cDistanceScannerWrapper", no_init)
.def("enable", &CDistanceScannerWrapper::Enable)
.def("disable", &CDistanceScannerWrapper::Disable)
.def("set_rpm", &CDistanceScannerWrapper::SetRPM)
.def("set_angle", &CDistanceScannerWrapper::SetAngle)
.def("get_readings", &CDistanceScannerWrapper::GetReadings)
.def("get_short_readings", &CDistanceScannerWrapper::GetShortReadings)
.def("get_long_readings", &CDistanceScannerWrapper::GetLongReadings);
// Export TurretWrapper, wrapper of CCI_FootBotTurretEncoderSensor and CCI_FootBotTurretActuator.
class_<CTurretWrapper, boost::noncopyable>("m_cTurretWrapper", no_init)
.def("get_rotation", &CTurretWrapper::GetRotation)
.def("set_rotation", &CTurretWrapper::SetRotation)
.def("set_rotation_speed", &CTurretWrapper::SetRotationSpeed)
.def("set_mode", &CTurretWrapper::SetMode)
.def("set_active_with_rotation", &CTurretWrapper::SetActiveWithRotation)
.def("set_speed_control_mode", &CTurretWrapper::SetSpeedControlMode)
.def("set_position_control_mode", &CTurretWrapper::SetPositionControlMode)
.def("set_passive_mode", &CTurretWrapper::SetPassiveMode);
// Export a CRadians - float map, used for the readings of the Distance Scanner Sensor.
// The map can be iterated. For a given map entry, get the key with map_entry.key()
// (map_entry.key().value() to get the actual angle value),
// and the value with map_entry.data()
class_<std::map<argos::CRadians, Real>>("distance_sensor_readings_map")
.def(boost::python::map_indexing_suite<std::map<argos::CRadians, Real>>());
// Export the CRadians class, used by the readings of various sensors.
// TODO: add more properties
class_<argos::CRadians>("radians", init<>())
.def(init<Real>())
.def("value", &argos::CRadians::GetValue);
// Export the SReading class, used to store the readings of the proximity sensor.
class_<argos::CCI_FootBotProximitySensor::SReading>("footbot_proximity_reading", no_init)
.def_readonly("value", &argos::CCI_FootBotProximitySensor::SReading::Value)
.def_readonly("angle", &argos::CCI_FootBotProximitySensor::SReading::Angle);
// Export the SReading class, used to store the readings of the proximity sensor.
class_<argos::CCI_EPuckProximitySensor::SReading>("epuck_proximity_reading", no_init)
.def_readonly("value", &argos::CCI_EPuckProximitySensor::SReading::Value)
.def_readonly("angle", &argos::CCI_EPuckProximitySensor::SReading::Angle);
// Export the SReading class, used to store the readings of the light sensor.
class_<argos::CCI_FootBotLightSensor::SReading>("footbot_light_reading", no_init)
.def_readonly("value", &argos::CCI_FootBotLightSensor::SReading::Value)
.def_readonly("angle", &argos::CCI_FootBotLightSensor::SReading::Angle);
// Export the SBlob class, used to store the readings of the omnidirectiona camera.
class_<argos::CCI_ColoredBlobOmnidirectionalCameraSensor::SBlob>("omnidirectional_camera_packet", no_init)
.def_readonly("distance", &argos::CCI_ColoredBlobOmnidirectionalCameraSensor::SBlob::Distance)
.def_readonly("angle", &argos::CCI_ColoredBlobOmnidirectionalCameraSensor::SBlob::Angle)
.def_readonly("color", &argos::CCI_ColoredBlobOmnidirectionalCameraSensor::SBlob::Color);
// Export the SPacket class, used to store the readings of the range and bearing sensor.
class_<argos::CCI_RangeAndBearingSensor::SPacket>("range_and_bearing_packet", no_init)
.add_property("range", &argos::CCI_RangeAndBearingSensor::SPacket::Range)
.add_property("horizontal_bearing", &argos::CCI_RangeAndBearingSensor::SPacket::HorizontalBearing)
.add_property("vertical_bearing", &argos::CCI_RangeAndBearingSensor::SPacket::VerticalBearing)
.add_property("data", &argos::CCI_RangeAndBearingSensor::SPacket::Data);
// Export the SReceivedPacket class, used to store the readings of the EPuck range and bearing sensor.
class_<argos::CCI_EPuckRangeAndBearingSensor::SReceivedPacket>("range_and_bearing_packet", no_init)
.add_property("range", &argos::CCI_EPuckRangeAndBearingSensor::SReceivedPacket::Range)
.add_property("bearing", &argos::CCI_EPuckRangeAndBearingSensor::SReceivedPacket::Bearing)
.add_property("data", &argos::CCI_EPuckRangeAndBearingSensor::SReceivedPacket::Data);
// Export the SReading class, used to store the readings of the motor ground sensor.
// Each reading contains a value and the offset, expressed in x/y coordinates.
class_<argos::CCI_FootBotMotorGroundSensor::SReading>("motor_ground_sensor_wrapper_reading", no_init)
.def_readonly("value", &argos::CCI_FootBotMotorGroundSensor::SReading::Value)
.def_readonly("offset", &argos::CCI_FootBotMotorGroundSensor::SReading::Offset);
// Export the SReading class, used to store the readings of the base ground sensor.
// Each reading contains a value and the offset, expressed in x/y coordinates.
class_<argos::CCI_FootBotBaseGroundSensor::SReading>("base_ground_sensor_wrapper_reading", no_init)
.def_readonly("value", &argos::CCI_FootBotBaseGroundSensor::SReading::Value)
.def_readonly("offset", &argos::CCI_FootBotBaseGroundSensor::SReading::Offset);
// Export the SReading class, used to store the readings of the EPuck ground sensor.
// Each reading has 3 values (left, center, right).
class_<argos::CCI_EPuckGroundSensor::SReadings>("epuck_ground_sensor_wrapper_reading", no_init)
.def_readonly("left", &argos::CCI_EPuckGroundSensor::SReadings::Left)
.def_readonly("center", &argos::CCI_EPuckGroundSensor::SReadings::Center)
.def_readonly("right", &argos::CCI_EPuckGroundSensor::SReadings::Right)
.def("__getitem__", &ActusensorsWrapper::EPuckGroundReadingsGetItem);
class_<argos::CVector2>("vector2", init<>())
.def(init<Real, Real>())
.add_property("x", &argos::CVector2::GetX, &argos::CVector2::SetX)
.add_property("y", &argos::CVector2::GetY, &argos::CVector2::SetY)
.def_readonly("length", &argos::CVector2::Length)
.def_readonly("angle", &argos::CVector2::Angle)
.def_readonly("square_length", &argos::CVector2::SquareLength);
// Export the ColorWrapper class.
class_<ActusensorsWrapper::CColorWrapper>("color", init<std::string>())
.def(init<UInt8, UInt8, UInt8>())
.add_property("raw_color", &ActusensorsWrapper::CColorWrapper::m_cColor);
// TODO: add other color stuff
// Export the CColor class. This class is not directly usable in python,
// but it is exported to simplify the usage of colors in python.
class_<argos::CColor>("raw_color", no_init)
.def("__eq__", &argos::CColor::operator==);
// Export the CByteArray class, and define new functions on it to access its data.
class_<argos::CByteArray>("c_byte_array", no_init)
.def("__getitem__", &ActusensorsWrapper::CByteArrayGetItem)
.def("__setitem__", &ActusensorsWrapper::CByteArraySetItem);
}