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