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
36namespace AL {
37class ALMotionProxy;
38class ALTask;
39} // namespace AL
40namespace fawkes {
41class HumanoidMotionInterface;
42class NaoSensorInterface;
43} // namespace fawkes
44
52{
53public:
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() */
62protected:
63 virtual void
65 {
66 Thread::run();
67 }
68
69private:
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
102private:
103 AL::ALPtr<AL::ALMotionProxy> almotion_;
104 AL::ALPtr<AL::ALThreadPool> thread_pool_;
105
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
Thread to provide NaoQi motions to Fawkes.
Definition: motion_thread.h:52
virtual void run()
Stub to see name in backtrace for easier debugging.
Definition: motion_thread.h:64
virtual void init()
Initialize the thread.
virtual void finalize()
Finalize the thread.
virtual ~NaoQiMotionThread()
Destructor.
virtual void loop()
Code to execute in the thread.
NaoQiMotionThread()
Constructor.
Thread aspect to access to BlackBoard.
Definition: blackboard.h:34
Thread aspect to use blocked timing.
Thread aspect that allows to obtain the current time from the clock.
Definition: clock.h:34
Thread aspect to access configuration data.
Definition: configurable.h:33
HumanoidMotionInterface Fawkes BlackBoard Interface.
Thread aspect to log output.
Definition: logging.h:33
Thread aspect to get access to NaoQi broker.
Definition: naoqi.h:36
NaoSensorInterface Fawkes BlackBoard Interface.
Thread class encapsulation of pthreads.
Definition: thread.h:46
Fawkes library namespace.