Fawkes API
Fawkes Development Version
motion_thread.h
1
2
/***************************************************************************
3
* motion_thread.h - Provide NaoQi motion to Fawkes
4
*
5
* Created: Thu Jun 09 12:56:42 2011
6
* Copyright 2006-2011 Tim Niemueller [www.niemueller.de]
7
*
8
****************************************************************************/
9
10
/* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2 of the License, or
13
* (at your option) any later version.
14
*
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU Library General Public License for more details.
19
*
20
* Read the full text in the LICENSE.GPL file in the doc directory.
21
*/
22
23
#ifndef _PLUGINS_NAO_MOTION_THREAD_H_
24
#define _PLUGINS_NAO_MOTION_THREAD_H_
25
26
#include <aspect/blackboard.h>
27
#include <aspect/blocked_timing.h>
28
#include <aspect/clock.h>
29
#include <aspect/configurable.h>
30
#include <aspect/logging.h>
31
#include <core/threading/thread.h>
32
#include <plugins/nao/aspect/naoqi.h>
33
34
#include <vector>
35
36
namespace
AL {
37
class
ALMotionProxy;
38
class
ALTask;
39
}
// namespace AL
40
namespace
fawkes
{
41
class
HumanoidMotionInterface;
42
class
NaoSensorInterface;
43
}
// namespace fawkes
44
45
class
NaoQiMotionThread
:
public
fawkes::Thread
,
46
public
fawkes::LoggingAspect
,
47
public
fawkes::ConfigurableAspect
,
48
public
fawkes::ClockAspect
,
49
public
fawkes::BlackBoardAspect
,
50
public
fawkes::BlockedTimingAspect
,
51
public
fawkes::NaoQiAspect
52
{
53
public
:
54
NaoQiMotionThread
();
55
virtual
~NaoQiMotionThread
();
56
57
virtual
void
init
();
58
virtual
void
loop
();
59
virtual
void
finalize
();
60
61
/** Stub to see name in backtrace for easier debugging. @see Thread::run() */
62
protected
:
63
virtual
void
64
run
()
65
{
66
Thread::run();
67
}
68
69
private
:
70
void
stop_motion();
71
void
process_messages();
72
void
fix_angles();
73
74
void
goto_body_angles(
float
head_yaw,
75
float
head_pitch,
76
float
l_shoulder_pitch,
77
float
l_shoulder_roll,
78
float
l_elbow_yaw,
79
float
l_elbow_roll,
80
float
l_wrist_yaw,
81
float
l_hand,
82
float
l_hip_yaw_pitch,
83
float
l_hip_roll,
84
float
l_hip_pitch,
85
float
l_knee_pitch,
86
float
l_ankle_pitch,
87
float
l_ankle_roll,
88
float
r_shoulder_pitch,
89
float
r_shoulder_roll,
90
float
r_elbow_yaw,
91
float
r_elbow_roll,
92
float
r_wrist_yaw,
93
float
r_hand,
94
float
r_hip_yaw_pitch,
95
float
r_hip_roll,
96
float
r_hip_pitch,
97
float
r_knee_pitch,
98
float
r_ankle_pitch,
99
float
r_ankle_roll,
100
float
time_sec);
101
102
private
:
103
AL::ALPtr<AL::ALMotionProxy> almotion_;
104
AL::ALPtr<AL::ALThreadPool> thread_pool_;
105
106
fawkes::HumanoidMotionInterface
*hummot_if_;
107
fawkes::NaoSensorInterface
* sensor_if_;
108
109
int
motion_task_id_;
110
int
head_task_id_;
111
AL::ALPtr<AL::ALTask> motion_task_;
112
};
113
114
#endif
NaoQiMotionThread::NaoQiMotionThread
NaoQiMotionThread()
Constructor.
Definition:
motion_thread.cpp:46
fawkes::NaoSensorInterface
Definition:
NaoSensorInterface.h:37
NaoQiMotionThread
Definition:
motion_thread.h:44
fawkes::NaoQiAspect
Definition:
naoqi.h:39
fawkes::BlockedTimingAspect
Definition:
blocked_timing.h:54
NaoQiMotionThread::init
virtual void init()
Initialize the thread.
Definition:
motion_thread.cpp:58
NaoQiMotionThread::loop
virtual void loop()
Code to execute in the thread.
Definition:
motion_thread.cpp:122
NaoQiMotionThread::finalize
virtual void finalize()
Finalize the thread.
Definition:
motion_thread.cpp:82
fawkes::BlackBoardAspect
Definition:
blackboard.h:36
fawkes::HumanoidMotionInterface
Definition:
HumanoidMotionInterface.h:37
fawkes
fawkes::LoggingAspect
Definition:
logging.h:36
fawkes::Thread
Definition:
thread.h:44
fawkes::ConfigurableAspect
Definition:
configurable.h:36
NaoQiMotionThread::run
virtual void run()
Stub to see name in backtrace for easier debugging.
Definition:
motion_thread.h:63
fawkes::ClockAspect
Definition:
clock.h:38
NaoQiMotionThread::~NaoQiMotionThread
virtual ~NaoQiMotionThread()
Destructor.
Definition:
motion_thread.cpp:53
src
plugins
nao
motion_thread.h
Generated by
1.8.16