Fawkes API
Fawkes Development Version
act_thread.cpp
1
2
/***************************************************************************
3
* act_thread.cpp - Dynamixel plugin act thread
4
*
5
* Created: Tue Mar 24 14:55:57 2015 (based on pantilt plugin)
6
* Copyright 2006-2015 Tim Niemueller [www.niemueller.de]
7
****************************************************************************/
8
9
/* This program is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation; either version 2 of the License, or
12
* (at your option) any later version.
13
*
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU Library General Public License for more details.
18
*
19
* Read the full text in the LICENSE.GPL file in the doc directory.
20
*/
21
22
#include "act_thread.h"
23
24
#include "driver_thread.h"
25
26
using namespace
fawkes
;
27
28
/** @class DynamixelActThread "act_thread.h"
29
* Robotis dynamixel servo act thread.
30
* This thread integrates into the Fawkes main loop at the ACT_EXEC hook and
31
* calls the driver thread to accept new actuation commands.
32
*
33
* @author Tim Niemueller
34
*/
35
36
/** Constructor. */
37
DynamixelActThread::DynamixelActThread
()
38
:
Thread
(
"DynamixelActThread"
,
Thread
::OPMODE_CONTINUOUS),
39
SyncPointAspect
(
SyncPoint
::WAIT_FOR_ALL,
"/sensors/acquire"
,
"/act/exec/end"
)
40
{
41
}
42
43
void
44
DynamixelActThread::loop
()
45
{
46
for
(
auto
&d : driver_threads_) {
47
d->exec_act();
48
}
49
}
50
51
/** Add a driver thread to wake in ACT hook.
52
* @param drv_thread driver thread to add
53
*/
54
void
55
DynamixelActThread::add_driver_thread
(
DynamixelDriverThread
*drv_thread)
56
{
57
driver_threads_.push_back(drv_thread);
58
}
DynamixelDriverThread
Definition:
driver_thread.h:50
DynamixelActThread::loop
virtual void loop()
Code to execute in the thread.
Definition:
act_thread.cpp:44
DynamixelActThread::DynamixelActThread
DynamixelActThread()
Constructor.
Definition:
act_thread.cpp:37
fawkes::SyncPoint
Definition:
syncpoint.h:53
fawkes
fawkes::Thread
Definition:
thread.h:44
DynamixelActThread::add_driver_thread
void add_driver_thread(DynamixelDriverThread *drv_thread)
Add a driver thread to wake in ACT hook.
Definition:
act_thread.cpp:55
fawkes::SyncPointAspect
Definition:
syncpoint.h:38
src
plugins
dynamixel
act_thread.cpp
Generated by
1.8.16