Revision ea068cf1 src/server/joint_interface.cpp
src/server/joint_interface.cpp | ||
---|---|---|
34 | 34 |
//! constructor |
35 | 35 |
JointInterface::JointInterface() { |
36 | 36 |
framerate = 50.0; |
37 |
mouth_enabled = false; |
|
38 |
gaze_enabled = false; |
|
37 |
mouth_enabled_ = false;
|
|
38 |
gaze_enabled_ = false;
|
|
39 | 39 |
} |
40 | 40 |
|
41 | 41 |
//! destructor |
... | ... | |
75 | 75 |
// lock the tsd_list for this access. by doing this we assure |
76 | 76 |
// that no other thread accessing this element can diturb the |
77 | 77 |
// following atomic instructions: |
78 |
mutex::scoped_lock sl(joint_ts_position_map_access_mutex); |
|
78 |
mutex::scoped_lock sl(joint_ts_position_map_access_mutex_);
|
|
79 | 79 |
|
80 | 80 |
// printf("> humotion: incoming joint position for joint id 0x%02X " |
81 | 81 |
// "= %4.2f (ts=%.2f)\n",joint_id,position,timestamp.to_seconds()); |
82 |
joint_ts_position_map[joint_id].insert(timestamp, position); |
|
82 |
joint_ts_position_map_[joint_id].insert(timestamp, position);
|
|
83 | 83 |
|
84 |
incoming_position_count++; |
|
84 |
incoming_position_count_++;
|
|
85 | 85 |
} |
86 | 86 |
|
87 | 87 |
//! return incoming position data count & clear this counter |
88 | 88 |
//! this can be used as a keep alive status check |
89 | 89 |
//! \return number of incoming joint positions since the last call |
90 | 90 |
unsigned int JointInterface::get_and_clear_incoming_position_count() { |
91 |
unsigned int i = incoming_position_count; |
|
92 |
incoming_position_count = 0; |
|
91 |
unsigned int i = incoming_position_count_;
|
|
92 |
incoming_position_count_ = 0;
|
|
93 | 93 |
return i; |
94 | 94 |
} |
95 | 95 |
|
... | ... | |
101 | 101 |
// lock the tsd_list for this access. by doing this we assure |
102 | 102 |
// that no other thread accessing this element can disturb the |
103 | 103 |
// following atomic instructions: |
104 |
mutex::scoped_lock scoped_lock(joint_ts_speed_map_access_mutex); |
|
104 |
mutex::scoped_lock scoped_lock(joint_ts_speed_map_access_mutex_);
|
|
105 | 105 |
|
106 | 106 |
// printf("> humotion: incoming joint velocity for joint id 0x%02X = %4.2f " |
107 | 107 |
// "(ts=%.2f)\n",joint_id,velocity,timestamp.to_seconds()); |
108 |
joint_ts_speed_map[joint_id].insert(timestamp, velocity); |
|
108 |
joint_ts_speed_map_[joint_id].insert(timestamp, velocity);
|
|
109 | 109 |
} |
110 | 110 |
|
111 | 111 |
//! return the timestamped float for the given joints position |
... | ... | |
113 | 113 |
// lock the tsd_list for this access. by doing this we assure |
114 | 114 |
// that no other thread accessing this element can disturb the |
115 | 115 |
// following atomic instructions |
116 |
mutex::scoped_lock sl(joint_ts_position_map_access_mutex); |
|
116 |
mutex::scoped_lock sl(joint_ts_position_map_access_mutex_);
|
|
117 | 117 |
|
118 | 118 |
// search map |
119 |
joint_tsl_map_t::iterator it = joint_ts_position_map.find(joint_id); |
|
119 |
joint_tsl_map_t::iterator it = joint_ts_position_map_.find(joint_id);
|
|
120 | 120 |
|
121 |
if (it == joint_ts_position_map.end()) { |
|
121 |
if (it == joint_ts_position_map_.end()) {
|
|
122 | 122 |
printf("> humotion: no ts_position for joint id 0x%02X found\n", joint_id); |
123 | 123 |
return TimestampedList(); |
124 | 124 |
} |
... | ... | |
132 | 132 |
// lock the tsd_list for this access. by doing this we assure |
133 | 133 |
// that no other thread accessing this element can diturb the |
134 | 134 |
// following atomic instructions |
135 |
mutex::scoped_lock sl(joint_ts_speed_map_access_mutex); |
|
135 |
mutex::scoped_lock sl(joint_ts_speed_map_access_mutex_);
|
|
136 | 136 |
|
137 | 137 |
// search map |
138 |
joint_tsl_map_t::iterator it = joint_ts_speed_map.find(joint_id); |
|
138 |
joint_tsl_map_t::iterator it = joint_ts_speed_map_.find(joint_id);
|
|
139 | 139 |
|
140 |
if (it == joint_ts_speed_map.end()) { |
|
140 |
if (it == joint_ts_speed_map_.end()) {
|
|
141 | 141 |
printf("> humotion: no ts_speed for joint id 0x%02X found\n", joint_id); |
142 | 142 |
return humotion::TimestampedList(); |
143 | 143 |
} |
... | ... | |
154 | 154 |
//! enable all mouth joints |
155 | 155 |
void JointInterface::enable_mouth_joints() { |
156 | 156 |
// already enabled? skip this |
157 |
if (mouth_enabled) { |
|
157 |
if (mouth_enabled_) {
|
|
158 | 158 |
return; |
159 | 159 |
} |
160 | 160 |
|
... | ... | |
165 | 165 |
enable_joint(ID_LIP_CENTER_LOWER); |
166 | 166 |
enable_joint(ID_LIP_RIGHT_UPPER); |
167 | 167 |
enable_joint(ID_LIP_RIGHT_LOWER); |
168 |
mouth_enabled = true; |
|
168 |
mouth_enabled_ = true;
|
|
169 | 169 |
} |
170 | 170 |
|
171 | 171 |
|
172 | 172 |
//! disable all mouth joints |
173 | 173 |
void JointInterface::disable_mouth_joints() { |
174 | 174 |
// already disabled? skip this |
175 |
if (!mouth_enabled) { |
|
175 |
if (!mouth_enabled_) {
|
|
176 | 176 |
return; |
177 | 177 |
} |
178 | 178 |
|
... | ... | |
183 | 183 |
disable_joint(ID_LIP_CENTER_LOWER); |
184 | 184 |
disable_joint(ID_LIP_RIGHT_UPPER); |
185 | 185 |
disable_joint(ID_LIP_RIGHT_LOWER); |
186 |
mouth_enabled = false; |
|
186 |
mouth_enabled_ = false;
|
|
187 | 187 |
} |
188 | 188 |
|
189 | 189 |
//! enable all gaze joints |
190 | 190 |
void JointInterface::enable_gaze_joints() { |
191 | 191 |
// already enabled? skip this |
192 |
if (gaze_enabled) { |
|
192 |
if (gaze_enabled_) {
|
|
193 | 193 |
return; |
194 | 194 |
} |
195 | 195 |
|
... | ... | |
210 | 210 |
enable_joint(ID_NECK_TILT); |
211 | 211 |
enable_joint(ID_NECK_ROLL); |
212 | 212 |
|
213 |
gaze_enabled = true; |
|
213 |
gaze_enabled_ = true;
|
|
214 | 214 |
} |
215 | 215 |
|
216 | 216 |
//! disable all gaze joints |
217 | 217 |
void JointInterface::disable_gaze_joints() { |
218 | 218 |
// already disabled? skip this |
219 |
if (!gaze_enabled) { |
|
219 |
if (!gaze_enabled_) {
|
|
220 | 220 |
return; |
221 | 221 |
} |
222 | 222 |
|
... | ... | |
237 | 237 |
disable_joint(ID_NECK_TILT); |
238 | 238 |
disable_joint(ID_NECK_ROLL); |
239 | 239 |
|
240 |
gaze_enabled = false; |
|
240 |
gaze_enabled_ = false;
|
|
241 | 241 |
} |
242 | 242 |
|
243 | 243 |
//! fetch maximum allowed joint position |
... | ... | |
257 | 257 |
//! check if joint position map is empty |
258 | 258 |
//! \return true if empty |
259 | 259 |
bool JointInterface::get_joint_position_map_empty() { |
260 |
return (joint_ts_position_map.empty()); |
|
260 |
return (joint_ts_position_map_.empty());
|
|
261 | 261 |
} |
262 | 262 |
|
263 | 263 |
//! call the virtual store function with given position and velocities |
Also available in: Unified diff