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