hlrc / server / src / EmotionConfig.cpp @ 5eb9025f
History | View | Annotate | Download (7.31 KB)
1 | 0c286af0 | Simon Schulz | /*
|
---|---|---|---|
2 | * This file is part of hlrc_server
|
||
3 | *
|
||
4 | * Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
|
||
5 | * http://opensource.cit-ec.de/projects/hlrc_server
|
||
6 | *
|
||
7 | * This file may be licensed under the terms of the
|
||
8 | * GNU General Public License Version 3 (the ``GPL''),
|
||
9 | * or (at your option) any later version.
|
||
10 | *
|
||
11 | * Software distributed under the License is distributed
|
||
12 | * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
|
||
13 | * express or implied. See the GPL for the specific language
|
||
14 | * governing rights and limitations.
|
||
15 | *
|
||
16 | * You should have received a copy of the GPL along with this
|
||
17 | * program. If not, go to http://www.gnu.org/licenses/gpl.html
|
||
18 | * or write to the Free Software Foundation, Inc.,
|
||
19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
20 | *
|
||
21 | * The development of this software was supported by the
|
||
22 | * Excellence Cluster EXC 277 Cognitive Interaction Technology.
|
||
23 | * The Excellence Cluster EXC 277 is a grant of the Deutsche
|
||
24 | * Forschungsgemeinschaft (DFG) in the context of the German
|
||
25 | * Excellence Initiative.
|
||
26 | *
|
||
27 | */
|
||
28 | |||
29 | #include "EmotionConfig.h" |
||
30 | using namespace boost; |
||
31 | |||
32 | EmotionConfig::EmotionConfig(){ |
||
33 | select_config(NEUTRAL); |
||
34 | } |
||
35 | |||
36 | EmotionConfig::EmotionConfig(EmotionType e){ |
||
37 | select_config(e); |
||
38 | } |
||
39 | |||
40 | EmotionConfig::~EmotionConfig(){ |
||
41 | } |
||
42 | |||
43 | |||
44 | bool EmotionConfig::is_active(){
|
||
45 | if (get_system_time() >= end_time){
|
||
46 | return false; |
||
47 | } |
||
48 | |||
49 | return true; |
||
50 | } |
||
51 | |||
52 | void EmotionConfig::set_duration(unsigned long ms){ |
||
53 | //set a timeout:
|
||
54 | end_time = get_system_time() + posix_time::milliseconds(ms); |
||
55 | } |
||
56 | |||
57 | void EmotionConfig::select_config(EmotionType e){
|
||
58 | switch((int) e){ |
||
59 | default:
|
||
60 | case(NEUTRAL): init_neutral(); break; |
||
61 | case(HAPPY ): init_happy(); break; |
||
62 | case(SAD ): init_sad(); break; |
||
63 | case(ANGRY ): init_angry(); break; |
||
64 | case(SURPRISED): init_surprised(); break; |
||
65 | case(FEAR): init_fear(); break; |
||
66 | } |
||
67 | } |
||
68 | |||
69 | void EmotionConfig::init_neutral(){
|
||
70 | //neutral = look straight
|
||
71 | gaze_override.pan_offset = 0.0; |
||
72 | gaze_override.tilt_offset = 0.0; |
||
73 | gaze_override.roll_offset = 0.0; |
||
74 | 16a22a2b | Simon Schulz | gaze_override.gaze_type = humotion::GazeState::GAZETYPE_ABSOLUTE; //GAZETYPE_OVERRIDE;
|
75 | 0c286af0 | Simon Schulz | |
76 | //not setable right now
|
||
77 | gaze_override.vergence = 0.0; |
||
78 | |||
79 | ded12eae | Simon Schulz | gaze_override.eyelid_opening_upper = 25.0; |
80 | gaze_override.eyelid_opening_lower = 30.0; |
||
81 | 0c286af0 | Simon Schulz | |
82 | //eyebrow angles
|
||
83 | gaze_override.eyebrow_left = -3.0; |
||
84 | gaze_override.eyebrow_right = 3.0; |
||
85 | |||
86 | //eyeblink request
|
||
87 | gaze_override.eyeblink_request_left = 0;
|
||
88 | gaze_override.eyeblink_request_right = 0;
|
||
89 | |||
90 | //mouth:
|
||
91 | mouth_override.position_left = 14.7; |
||
92 | mouth_override.opening_left = 0.0; |
||
93 | mouth_override.position_center = 16.0; |
||
94 | mouth_override.opening_center = 1.0; |
||
95 | mouth_override.position_right = 14.7; |
||
96 | mouth_override.opening_right = 0.0; |
||
97 | |||
98 | } |
||
99 | |||
100 | void EmotionConfig::init_happy(){
|
||
101 | //neutral = look straight
|
||
102 | gaze_override.pan_offset = 0.0; |
||
103 | gaze_override.tilt_offset = 0.0; |
||
104 | gaze_override.roll_offset = 0.0; |
||
105 | 16a22a2b | Simon Schulz | gaze_override.gaze_type = humotion::GazeState::GAZETYPE_ABSOLUTE; //GAZETYPE_OVERRIDE;
|
106 | 0c286af0 | Simon Schulz | |
107 | //not setable right now
|
||
108 | gaze_override.vergence = 0.0; |
||
109 | |||
110 | ded12eae | Simon Schulz | gaze_override.eyelid_opening_upper = 30.0; |
111 | gaze_override.eyelid_opening_lower = 30.0; |
||
112 | 0c286af0 | Simon Schulz | |
113 | //eyebrow angles
|
||
114 | gaze_override.eyebrow_left = -1.0; |
||
115 | gaze_override.eyebrow_right = 1.0; |
||
116 | |||
117 | //eyeblink request
|
||
118 | gaze_override.eyeblink_request_left = humotion::GazeState::EYEBLINK_TIME_DEFAULT; |
||
119 | gaze_override.eyeblink_request_right = humotion::GazeState::EYEBLINK_TIME_DEFAULT; |
||
120 | |||
121 | //mouth:
|
||
122 | mouth_override.position_left = 12.5; |
||
123 | mouth_override.opening_left = 0.0; |
||
124 | mouth_override.position_center = 14.88; |
||
125 | mouth_override.opening_center = 7.4; |
||
126 | mouth_override.position_right = 12.5; |
||
127 | mouth_override.opening_right = 0.0; |
||
128 | |||
129 | } |
||
130 | |||
131 | void EmotionConfig::init_sad(){
|
||
132 | gaze_override.pan_offset = 0.0; |
||
133 | gaze_override.tilt_offset = -3.0; |
||
134 | gaze_override.roll_offset = -3.0; |
||
135 | 16a22a2b | Simon Schulz | gaze_override.gaze_type = humotion::GazeState::GAZETYPE_ABSOLUTE; //GAZETYPE_OVERRIDE;
|
136 | 0c286af0 | Simon Schulz | |
137 | //not setable right now
|
||
138 | gaze_override.vergence = 0.0; |
||
139 | |||
140 | gaze_override.eyelid_opening_upper = 15.0; |
||
141 | gaze_override.eyelid_opening_lower = 40.0; |
||
142 | |||
143 | //eyebrow angles
|
||
144 | gaze_override.eyebrow_left = -20.0; |
||
145 | gaze_override.eyebrow_right = 20.0; |
||
146 | |||
147 | //eyeblink request
|
||
148 | gaze_override.eyeblink_request_left = 3 * humotion::GazeState::EYEBLINK_TIME_DEFAULT;
|
||
149 | gaze_override.eyeblink_request_right = 3 * humotion::GazeState::EYEBLINK_TIME_DEFAULT;
|
||
150 | |||
151 | //mouth:
|
||
152 | mouth_override.position_left = 20.0; |
||
153 | mouth_override.opening_left = 0.0; |
||
154 | mouth_override.position_center = 16.1; |
||
155 | mouth_override.opening_center = 4.0; |
||
156 | mouth_override.position_right = 20.0; |
||
157 | mouth_override.opening_right = 0.0; |
||
158 | } |
||
159 | |||
160 | void EmotionConfig::init_angry(){
|
||
161 | gaze_override.pan_offset = 0.0; |
||
162 | gaze_override.tilt_offset = -5.0; |
||
163 | gaze_override.roll_offset = 0.0; |
||
164 | 16a22a2b | Simon Schulz | gaze_override.gaze_type = humotion::GazeState::GAZETYPE_ABSOLUTE; //GAZETYPE_OVERRIDE;
|
165 | 0c286af0 | Simon Schulz | |
166 | //not setable right now
|
||
167 | gaze_override.vergence = 0.0; |
||
168 | |||
169 | gaze_override.eyelid_opening_upper = 18.0; |
||
170 | gaze_override.eyelid_opening_lower = 18.0; |
||
171 | |||
172 | //eyebrow angles
|
||
173 | gaze_override.eyebrow_left = 21.0; |
||
174 | gaze_override.eyebrow_right = -21.0; |
||
175 | |||
176 | //eyeblink request
|
||
177 | gaze_override.eyeblink_request_left = 0;
|
||
178 | gaze_override.eyeblink_request_right = 0;
|
||
179 | |||
180 | //mouth:
|
||
181 | mouth_override.position_left = 12.5; |
||
182 | mouth_override.opening_left = 0.0; |
||
183 | mouth_override.position_center = 16.3; |
||
184 | mouth_override.opening_center = 2.0; |
||
185 | mouth_override.position_right = 17.5; |
||
186 | mouth_override.opening_right = 0.0; |
||
187 | } |
||
188 | |||
189 | void EmotionConfig::init_surprised(){
|
||
190 | gaze_override.pan_offset = 0.0; |
||
191 | gaze_override.tilt_offset = 8.0; |
||
192 | gaze_override.roll_offset = 0.0; |
||
193 | 16a22a2b | Simon Schulz | gaze_override.gaze_type = humotion::GazeState::GAZETYPE_ABSOLUTE; //GAZETYPE_OVERRIDE;
|
194 | 0c286af0 | Simon Schulz | |
195 | //not setable right now
|
||
196 | gaze_override.vergence = 0.0; |
||
197 | |||
198 | //eyelids
|
||
199 | gaze_override.eyelid_opening_upper = 60.0; |
||
200 | gaze_override.eyelid_opening_lower = 60.0; |
||
201 | |||
202 | //eyebrow angles
|
||
203 | gaze_override.eyebrow_left = -2.0; |
||
204 | gaze_override.eyebrow_right = 2.0; |
||
205 | |||
206 | //eyeblink request
|
||
207 | gaze_override.eyeblink_request_left = humotion::GazeState::EYEBLINK_TIME_DEFAULT; |
||
208 | gaze_override.eyeblink_request_right = humotion::GazeState::EYEBLINK_TIME_DEFAULT; |
||
209 | |||
210 | //mouth:
|
||
211 | mouth_override.position_left = 12.5; |
||
212 | mouth_override.opening_left = 0.0; |
||
213 | mouth_override.position_center = 16.3; |
||
214 | mouth_override.opening_center = 9.0; |
||
215 | mouth_override.position_right = 12.5; |
||
216 | mouth_override.opening_right = 0.0; |
||
217 | } |
||
218 | |||
219 | void EmotionConfig::init_fear(){
|
||
220 | gaze_override.pan_offset = 5.0; |
||
221 | gaze_override.tilt_offset = 0.0; |
||
222 | gaze_override.roll_offset = 0.0; |
||
223 | 3787a859 | Simon Schulz | gaze_override.gaze_type = humotion::GazeState::GAZETYPE_ABSOLUTE; |
224 | 0c286af0 | Simon Schulz | |
225 | //not setable right now
|
||
226 | gaze_override.vergence = 0.0; |
||
227 | |||
228 | gaze_override.eyelid_opening_upper = 50.0; |
||
229 | gaze_override.eyelid_opening_lower = 50.0; |
||
230 | |||
231 | |||
232 | //eyebrow angles
|
||
233 | gaze_override.eyebrow_left = -23.0; |
||
234 | gaze_override.eyebrow_right = 23.0; |
||
235 | |||
236 | //eyeblink request
|
||
237 | gaze_override.eyeblink_request_left = 0;
|
||
238 | gaze_override.eyeblink_request_right = 0;
|
||
239 | |||
240 | //mouth:
|
||
241 | mouth_override.position_left = 18.9; |
||
242 | mouth_override.opening_left = 0.0; |
||
243 | mouth_override.position_center = 16.3; |
||
244 | mouth_override.opening_center = 2.2; |
||
245 | mouth_override.position_right = 18.9; |
||
246 | mouth_override.opening_right = 0.0; |
||
247 | } |