Revision 5d7ba19c src/server/controller.cpp
src/server/controller.cpp | ||
---|---|---|
37 | 37 |
using namespace humotion::server; |
38 | 38 |
|
39 | 39 |
//! constructor |
40 |
Controller::Controller(JointInterface *j){ |
|
40 |
Controller::Controller(JointInterface *j) : activated(false) {
|
|
41 | 41 |
joint_interface = j; |
42 | 42 |
} |
43 | 43 |
|
... | ... | |
121 | 121 |
return absolute_gaze; |
122 | 122 |
} |
123 | 123 |
|
124 |
|
|
124 |
//! activate controller |
|
125 |
void Controller::set_activated(void){ |
|
126 |
activated = true; |
|
127 |
} |
|
125 | 128 |
|
126 | 129 |
//! update gaze target: |
127 | 130 |
//! \param GazeState with target values for the overall gaze |
128 | 131 |
void Controller::set_gaze_target(GazeState new_gaze_target){ |
132 |
if (!activated){ |
|
133 |
//not yet initialized, ignore incoming targets |
|
134 |
return; |
|
135 |
} |
|
136 |
|
|
129 | 137 |
GazeState target_gaze; |
130 | 138 |
|
131 | 139 |
//relative or absolute gaze update? |
... | ... | |
146 | 154 |
//! update mouth state: |
147 | 155 |
//! \param MouthState with target values for the mouth joints |
148 | 156 |
void Controller::set_mouth_target(MouthState s){ |
157 |
if (!activated){ |
|
158 |
//not yet initialized, ignore incoming targets |
|
159 |
return; |
|
160 |
} |
|
161 |
|
|
149 | 162 |
for(motion_generator_vector_t::iterator it = motion_generator_vector.begin(); it<motion_generator_vector.end(); it++){ |
150 | 163 |
(*it)->set_mouth_target(s); |
151 | 164 |
} |
Also available in: Unified diff