1 |
|
|
/* |
2 |
|
|
* Copyright 2016, |
3 |
|
|
* |
4 |
|
|
* Olivier Stasse |
5 |
|
|
* |
6 |
|
|
* LAAS, CNRS |
7 |
|
|
* |
8 |
|
|
* This file is part of TALOSController. |
9 |
|
|
* TALOSController is a free software, |
10 |
|
|
* |
11 |
|
|
*/ |
12 |
|
|
|
13 |
|
|
#include <sot/core/debug.hh> |
14 |
|
|
|
15 |
|
|
/* Pyrene is the first TALOS */ |
16 |
|
|
#define ROBOTNAME std::string("PYRENE") |
17 |
|
|
|
18 |
|
|
#include "sot-pyrene-controller.hh" |
19 |
|
|
|
20 |
|
|
const std::string SoTPyreneController::LOG_PYTHON_PYRENE = |
21 |
|
|
"/tmp/PyreneController_python.out"; |
22 |
|
|
|
23 |
|
|
SoTPyreneController::SoTPyreneController() : SoTTalosController(ROBOTNAME) { |
24 |
|
|
startupPython(); |
25 |
|
|
interpreter_->startRosService(); |
26 |
|
|
} |
27 |
|
|
|
28 |
|
|
void SoTPyreneController::startupPython() { |
29 |
|
|
SoTTalosController::startupPython(); |
30 |
|
|
std::ofstream aof(LOG_PYTHON_PYRENE.c_str()); |
31 |
|
|
|
32 |
|
|
runPython(aof, "from dynamic_graph.sot.pyrene.prologue import makeRobot", |
33 |
|
|
*interpreter_); |
34 |
|
|
runPython(aof, "robot = makeRobot ()", *interpreter_); |
35 |
|
|
aof.close(); |
36 |
|
|
} |
37 |
|
|
|
38 |
|
|
extern "C" { |
39 |
|
|
dgsot::AbstractSotExternalInterface *createSotExternalInterface() { |
40 |
|
|
return new SoTPyreneController; |
41 |
|
|
} |
42 |
|
|
} |
43 |
|
|
|
44 |
|
|
extern "C" { |
45 |
|
|
void destroySotExternalInterface(dgsot::AbstractSotExternalInterface *p) { |
46 |
|
|
delete p; |
47 |
|
|
} |
48 |
|
|
} |