Fawkes API
Fawkes Development Version
sensor_thread.cpp
1
2
/***************************************************************************
3
* sensor_thread.cpp - Robotis dynamixel servo sensor integration thread
4
*
5
* Created: Mon Mar 23 20:20:02 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 "sensor_thread.h"
23
24
#include "driver_thread.h"
25
26
using namespace
fawkes
;
27
28
/** @class DynamixelSensorThread "sensor_thread.h"
29
* Robotis dynamixel servo sensor thread.
30
* This thread integrates into the Fawkes main loop at the SENSOR hook and
31
* triggers the driver thread to retrieve and write new sensor data.
32
* @author Tim Niemueller
33
*/
34
35
/** Constructor. */
36
DynamixelSensorThread::DynamixelSensorThread
()
37
:
Thread
(
"DynamixelSensorThread"
,
Thread
::OPMODE_WAITFORWAKEUP),
38
BlockedTimingAspect
(
BlockedTimingAspect
::WAKEUP_HOOK_SENSOR_ACQUIRE)
39
{
40
}
41
42
void
43
DynamixelSensorThread::loop
()
44
{
45
for
(
auto
&d : driver_threads_) {
46
d->exec_sensor();
47
}
48
}
49
50
/** Add a driver thread to wake in SENSOR_ACQUIRE hook.
51
* @param drv_thread driver thread to add
52
*/
53
void
54
DynamixelSensorThread::add_driver_thread
(
DynamixelDriverThread
*drv_thread)
55
{
56
driver_threads_.push_back(drv_thread);
57
}
DynamixelDriverThread
Definition:
driver_thread.h:50
DynamixelSensorThread::add_driver_thread
void add_driver_thread(DynamixelDriverThread *drv_thread)
Add a driver thread to wake in SENSOR_ACQUIRE hook.
Definition:
sensor_thread.cpp:53
DynamixelSensorThread::loop
virtual void loop()
Code to execute in the thread.
Definition:
sensor_thread.cpp:42
DynamixelSensorThread::DynamixelSensorThread
DynamixelSensorThread()
Constructor.
Definition:
sensor_thread.cpp:35
fawkes::BlockedTimingAspect
Definition:
blocked_timing.h:54
fawkes
fawkes::Thread
Definition:
thread.h:44
src
plugins
dynamixel
sensor_thread.cpp
Generated by
1.8.16