Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Stack Of Tasks
sot-talos
Commits
0454574e
Commit
0454574e
authored
Sep 26, 2018
by
Joseph Mirabel
Browse files
Remove thread that creates the interpreter.
parent
aa6005bb
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/sot-talos-controller.cpp
View file @
0454574e
...
...
@@ -27,27 +27,6 @@ const std::string SoTTalosController::LOG_PYTHON="/tmp/TalosController_python.ou
using
namespace
std
;
boost
::
condition_variable
cond
;
boost
::
mutex
mut
;
bool
data_ready
;
void
workThread
(
SoTTalosController
*
aSoTTalos
)
{
dynamicgraph
::
Interpreter
aLocalInterpreter
(
dynamicgraph
::
rosInit
(
false
,
true
));
aSoTTalos
->
interpreter_
=
boost
::
make_shared
<
dynamicgraph
::
Interpreter
>
(
aLocalInterpreter
);
std
::
cout
<<
"Going through the thread."
<<
std
::
endl
;
{
boost
::
lock_guard
<
boost
::
mutex
>
lock
(
mut
);
data_ready
=
true
;
}
cond
.
notify_all
();
ros
::
waitForShutdown
();
}
SoTTalosController
::
SoTTalosController
(
std
::
string
RobotName
)
:
device_
(
RobotName
)
{
...
...
@@ -63,14 +42,15 @@ SoTTalosController::SoTTalosController(const char robotName[]):
void
SoTTalosController
::
init
()
{
std
::
cout
<<
"Going through SoTTalosController."
<<
std
::
endl
;
boost
::
thread
thr
(
workThread
,
this
);
ros
::
NodeHandle
&
nh
=
dynamicgraph
::
rosInit
(
false
,
true
);
interpreter_
=
boost
::
shared_ptr
<
dynamicgraph
::
Interpreter
>
(
new
dynamicgraph
::
Interpreter
(
nh
));
sotDEBUG
(
25
)
<<
__FILE__
<<
":"
<<
__FUNCTION__
<<
"(#"
<<
__LINE__
<<
" )"
<<
std
::
endl
;
boost
::
unique_lock
<
boost
::
mutex
>
lock
(
mut
);
cond
.
wait
(
lock
);
double
ts
=
ros
::
param
::
param
<
double
>
(
"/sot_controller/dt"
,
SoTTalosDevice
::
TIMESTEP_DEFAULT
);
device_
.
timeStep
(
ts
);
}
...
...
src/sot-talos-controller.hh
View file @
0454574e
...
...
@@ -48,6 +48,9 @@ class SoTTalosController: public
/// Embedded python interpreter accessible via Corba/ros
boost
::
shared_ptr
<
dynamicgraph
::
Interpreter
>
interpreter_
;
boost
::
shared_ptr
<
ros
::
NodeHandle
>
nh_
;
boost
::
shared_ptr
<
ros
::
AsyncSpinner
>
spinner_
;
protected:
// Update output port with the control computed from the
// dynamic graph.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment