hlrc / server / src / EmotionConfig.cpp @ 6dee6447
History | View | Annotate | Download (8.359 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 | |||
31 | EmotionConfig::EmotionConfig(){ |
||
32 | select_config(NEUTRAL); |
||
33 | } |
||
34 | |||
35 | EmotionConfig::EmotionConfig(EmotionType e){ |
||
36 | select_config(e); |
||
37 | } |
||
38 | |||
39 | EmotionConfig::~EmotionConfig(){ |
||
40 | } |
||
41 | |||
42 | |||
43 | bool EmotionConfig::is_active(){
|
||
44 | 6dee6447 | Guillaume Walck | if (end_time.time_since_epoch().count() == 0) |
45 | return true; |
||
46 | 9cb381ec | Robert Haschke | if (std::chrono::steady_clock::now() >= end_time){
|
47 | 0c286af0 | Simon Schulz | return false; |
48 | } |
||
49 | |||
50 | return true; |
||
51 | } |
||
52 | |||
53 | void EmotionConfig::set_duration(unsigned long ms){ |
||
54 | //set a timeout:
|
||
55 | 9cb381ec | Robert Haschke | end_time = std::chrono::steady_clock::now() + std::chrono::milliseconds(ms); |
56 | 0c286af0 | Simon Schulz | } |
57 | |||
58 | void EmotionConfig::select_config(EmotionType e){
|
||
59 | efbcb710 | sschulz | // default overblend time
|
60 | overblend_time_ms = 500;
|
||
61 | |||
62 | 0c286af0 | Simon Schulz | switch((int) e){ |
63 | default:
|
||
64 | case(NEUTRAL): init_neutral(); break; |
||
65 | case(HAPPY ): init_happy(); break; |
||
66 | case(SAD ): init_sad(); break; |
||
67 | case(ANGRY ): init_angry(); break; |
||
68 | case(SURPRISED): init_surprised(); break; |
||
69 | case(FEAR): init_fear(); break; |
||
70 | } |
||
71 | } |
||
72 | |||
73 | void EmotionConfig::init_neutral(){
|
||
74 | //neutral = look straight
|
||
75 | gaze_override.pan_offset = 0.0; |
||
76 | gaze_override.tilt_offset = 0.0; |
||
77 | gaze_override.roll_offset = 0.0; |
||
78 | 16a22a2b | Simon Schulz | gaze_override.gaze_type = humotion::GazeState::GAZETYPE_ABSOLUTE; //GAZETYPE_OVERRIDE;
|
79 | 0c286af0 | Simon Schulz | |
80 | //not setable right now
|
||
81 | gaze_override.vergence = 0.0; |
||
82 | |||
83 | ded12eae | Simon Schulz | gaze_override.eyelid_opening_upper = 25.0; |
84 | gaze_override.eyelid_opening_lower = 30.0; |
||
85 | 0c286af0 | Simon Schulz | |
86 | //eyebrow angles
|
||
87 | gaze_override.eyebrow_left = -3.0; |
||
88 | gaze_override.eyebrow_right = 3.0; |
||
89 | |||
90 | //eyeblink request
|
||
91 | gaze_override.eyeblink_request_left = 0;
|
||
92 | gaze_override.eyeblink_request_right = 0;
|
||
93 | |||
94 | //mouth:
|
||
95 | 0ca8388c | clf | /*mouth_override.position_left = 14.7;
|
96 | 0c286af0 | Simon Schulz | mouth_override.opening_left = 0.0;
|
97 | mouth_override.position_center = 16.0;
|
||
98 | mouth_override.opening_center = 1.0;
|
||
99 | mouth_override.position_right = 14.7;
|
||
100 | 0ca8388c | clf | mouth_override.opening_right = 0.0;*/
|
101 | bb168e08 | Your Name | /*mouth_override.position_left = 11.54200000000000000000;
|
102 | 0ca8388c | clf | mouth_override.opening_left = 0; //2.412000;
|
103 | mouth_override.position_center = 12.50000000000000000;
|
||
104 | mouth_override.opening_center = 0; //1.737000;
|
||
105 | mouth_override.position_right = 11.5250000000000000000;
|
||
106 | mouth_override.opening_right = 0;//2.412000;
|
||
107 | bb168e08 | Your Name | */
|
108 | 9cb381ec | Robert Haschke | |
109 | bb168e08 | Your Name | mouth_override.position_left = 20;
|
110 | mouth_override.opening_left = 0.0; |
||
111 | 9ee9f0b4 | Your Name | mouth_override.position_center = 22;
|
112 | mouth_override.opening_center = 2.0; |
||
113 | mouth_override.position_right = 20-2; |
||
114 | bb168e08 | Your Name | mouth_override.opening_right = 0.0; |
115 | 1e1c61a8 | sschulz | |
116 | 0c286af0 | Simon Schulz | } |
117 | |||
118 | void EmotionConfig::init_happy(){
|
||
119 | //neutral = look straight
|
||
120 | gaze_override.pan_offset = 0.0; |
||
121 | gaze_override.tilt_offset = 0.0; |
||
122 | gaze_override.roll_offset = 0.0; |
||
123 | 16a22a2b | Simon Schulz | gaze_override.gaze_type = humotion::GazeState::GAZETYPE_ABSOLUTE; //GAZETYPE_OVERRIDE;
|
124 | 0c286af0 | Simon Schulz | |
125 | //not setable right now
|
||
126 | gaze_override.vergence = 0.0; |
||
127 | |||
128 | ded12eae | Simon Schulz | gaze_override.eyelid_opening_upper = 30.0; |
129 | gaze_override.eyelid_opening_lower = 30.0; |
||
130 | 0c286af0 | Simon Schulz | |
131 | //eyebrow angles
|
||
132 | gaze_override.eyebrow_left = -1.0; |
||
133 | gaze_override.eyebrow_right = 1.0; |
||
134 | |||
135 | //eyeblink request
|
||
136 | gaze_override.eyeblink_request_left = humotion::GazeState::EYEBLINK_TIME_DEFAULT; |
||
137 | gaze_override.eyeblink_request_right = humotion::GazeState::EYEBLINK_TIME_DEFAULT; |
||
138 | bb168e08 | Your Name | /*
|
139 | 0ca8388c | clf | mouth_override.position_left = -1+9.5;
|
140 | 0c286af0 | Simon Schulz | mouth_override.opening_left = 0.0;
|
141 | 0ca8388c | clf | mouth_override.position_center = 24.3;
|
142 | mouth_override.opening_center = 7.0;
|
||
143 | mouth_override.position_right = -1+10.5;
|
||
144 | bb168e08 | Your Name | mouth_override.opening_right = 0.0;*/
|
145 | 9cb381ec | Robert Haschke | |
146 | bb168e08 | Your Name | mouth_override.position_left = 18; //13.56850000000000000000; |
147 | mouth_override.opening_left = 0; //.791000; |
||
148 | mouth_override.position_center = 26; //14.18400000000000000000; |
||
149 | mouth_override.opening_center = 5;
|
||
150 | mouth_override.position_right = 18; //15.31800000000000000000; |
||
151 | mouth_override.opening_right = 0; //2.791000; |
||
152 | |||
153 | 9cb381ec | Robert Haschke | |
154 | 0c286af0 | Simon Schulz | |
155 | } |
||
156 | |||
157 | void EmotionConfig::init_sad(){
|
||
158 | gaze_override.pan_offset = 0.0; |
||
159 | 1e1c61a8 | sschulz | gaze_override.tilt_offset = -3.0; |
160 | 0c286af0 | Simon Schulz | gaze_override.roll_offset = -3.0; |
161 | 16a22a2b | Simon Schulz | gaze_override.gaze_type = humotion::GazeState::GAZETYPE_ABSOLUTE; //GAZETYPE_OVERRIDE;
|
162 | 0c286af0 | Simon Schulz | |
163 | //not setable right now
|
||
164 | gaze_override.vergence = 0.0; |
||
165 | |||
166 | gaze_override.eyelid_opening_upper = 15.0; |
||
167 | gaze_override.eyelid_opening_lower = 40.0; |
||
168 | |||
169 | //eyebrow angles
|
||
170 | gaze_override.eyebrow_left = -20.0; |
||
171 | gaze_override.eyebrow_right = 20.0; |
||
172 | |||
173 | //eyeblink request
|
||
174 | gaze_override.eyeblink_request_left = 3 * humotion::GazeState::EYEBLINK_TIME_DEFAULT;
|
||
175 | gaze_override.eyeblink_request_right = 3 * humotion::GazeState::EYEBLINK_TIME_DEFAULT;
|
||
176 | |||
177 | //mouth:
|
||
178 | bb168e08 | Your Name | mouth_override.position_left = 21.0; |
179 | 0c286af0 | Simon Schulz | mouth_override.opening_left = 0.0; |
180 | bb168e08 | Your Name | mouth_override.position_center = 16.0; |
181 | 0ca8388c | clf | mouth_override.opening_center = 0.0; |
182 | bb168e08 | Your Name | mouth_override.position_right = 21.0; |
183 | 0c286af0 | Simon Schulz | mouth_override.opening_right = 0.0; |
184 | } |
||
185 | |||
186 | void EmotionConfig::init_angry(){
|
||
187 | gaze_override.pan_offset = 0.0; |
||
188 | gaze_override.tilt_offset = -5.0; |
||
189 | gaze_override.roll_offset = 0.0; |
||
190 | 16a22a2b | Simon Schulz | gaze_override.gaze_type = humotion::GazeState::GAZETYPE_ABSOLUTE; //GAZETYPE_OVERRIDE;
|
191 | 0c286af0 | Simon Schulz | |
192 | //not setable right now
|
||
193 | gaze_override.vergence = 0.0; |
||
194 | |||
195 | gaze_override.eyelid_opening_upper = 18.0; |
||
196 | gaze_override.eyelid_opening_lower = 18.0; |
||
197 | |||
198 | //eyebrow angles
|
||
199 | gaze_override.eyebrow_left = 21.0; |
||
200 | gaze_override.eyebrow_right = -21.0; |
||
201 | |||
202 | //eyeblink request
|
||
203 | gaze_override.eyeblink_request_left = 0;
|
||
204 | gaze_override.eyeblink_request_right = 0;
|
||
205 | |||
206 | //mouth:
|
||
207 | bb168e08 | Your Name | mouth_override.position_left = 21;
|
208 | mouth_override.opening_left = 6.0; |
||
209 | mouth_override.position_center = 22.3; |
||
210 | 0ca8388c | clf | mouth_override.opening_center = 0.0; |
211 | bb168e08 | Your Name | mouth_override.position_right = 21;
|
212 | mouth_override.opening_right = 6.0; |
||
213 | 0c286af0 | Simon Schulz | } |
214 | |||
215 | void EmotionConfig::init_surprised(){
|
||
216 | gaze_override.pan_offset = 0.0; |
||
217 | gaze_override.tilt_offset = 8.0; |
||
218 | gaze_override.roll_offset = 0.0; |
||
219 | 16a22a2b | Simon Schulz | gaze_override.gaze_type = humotion::GazeState::GAZETYPE_ABSOLUTE; //GAZETYPE_OVERRIDE;
|
220 | 0c286af0 | Simon Schulz | |
221 | //not setable right now
|
||
222 | gaze_override.vergence = 0.0; |
||
223 | |||
224 | //eyelids
|
||
225 | gaze_override.eyelid_opening_upper = 60.0; |
||
226 | gaze_override.eyelid_opening_lower = 60.0; |
||
227 | |||
228 | //eyebrow angles
|
||
229 | gaze_override.eyebrow_left = -2.0; |
||
230 | gaze_override.eyebrow_right = 2.0; |
||
231 | |||
232 | //eyeblink request
|
||
233 | gaze_override.eyeblink_request_left = humotion::GazeState::EYEBLINK_TIME_DEFAULT; |
||
234 | gaze_override.eyeblink_request_right = humotion::GazeState::EYEBLINK_TIME_DEFAULT; |
||
235 | |||
236 | //mouth:
|
||
237 | bb168e08 | Your Name | mouth_override.position_left = 22;
|
238 | mouth_override.opening_left = 0.0; |
||
239 | mouth_override.position_center = 26.0; |
||
240 | mouth_override.opening_center = 10.0; |
||
241 | mouth_override.position_right = 22.0; |
||
242 | mouth_override.opening_right = 0.0; |
||
243 | 0ca8388c | clf | |
244 | 9cb381ec | Robert Haschke | |
245 | 0c286af0 | Simon Schulz | } |
246 | |||
247 | void EmotionConfig::init_fear(){
|
||
248 | gaze_override.pan_offset = 5.0; |
||
249 | gaze_override.tilt_offset = 0.0; |
||
250 | gaze_override.roll_offset = 0.0; |
||
251 | 3787a859 | Simon Schulz | gaze_override.gaze_type = humotion::GazeState::GAZETYPE_ABSOLUTE; |
252 | 0c286af0 | Simon Schulz | |
253 | //not setable right now
|
||
254 | gaze_override.vergence = 0.0; |
||
255 | |||
256 | gaze_override.eyelid_opening_upper = 50.0; |
||
257 | gaze_override.eyelid_opening_lower = 50.0; |
||
258 | |||
259 | |||
260 | //eyebrow angles
|
||
261 | gaze_override.eyebrow_left = -23.0; |
||
262 | gaze_override.eyebrow_right = 23.0; |
||
263 | |||
264 | //eyeblink request
|
||
265 | gaze_override.eyeblink_request_left = 0;
|
||
266 | gaze_override.eyeblink_request_right = 0;
|
||
267 | |||
268 | //mouth:
|
||
269 | bb168e08 | Your Name | mouth_override.position_left = 14;
|
270 | 0c286af0 | Simon Schulz | mouth_override.opening_left = 0.0; |
271 | bb168e08 | Your Name | mouth_override.position_center = 21;
|
272 | mouth_override.opening_center = 5;
|
||
273 | mouth_override.position_right = 35.9; |
||
274 | 0c286af0 | Simon Schulz | mouth_override.opening_right = 0.0; |
275 | } |