Revision ea29304b examples/yarp_icub/src/icub_jointinterface.cpp
examples/yarp_icub/src/icub_jointinterface.cpp | ||
---|---|---|
320 | 320 |
} |
321 | 321 |
|
322 | 322 |
|
323 |
//! set the current position of a joint |
|
324 |
//! \param id of joint |
|
325 |
//! \param float value of position |
|
326 |
//! \param double timestamp |
|
327 |
void iCubJointInterface::store_incoming_position(int humotion_id, double position, double timestamp){ |
|
328 |
cout << "iCubJointInterface::store_incoming_position(humotionid=" << humotion_id << |
|
329 |
", " << position << ", ...)\n"; |
|
330 |
|
|
331 |
JointInterface::store_incoming_position(humotion_id, position, timestamp); |
|
332 |
} |
|
333 |
/* |
|
334 |
//store joint based on id: |
|
335 |
switch(id){ |
|
336 |
default: |
|
337 |
//printf("> ERROR: unhandled joint id %d\n",id); |
|
338 |
return; |
|
339 |
|
|
340 |
case(100): |
|
341 |
//JointInterface::store_incoming_position(ID_EYES_RIGHT_LID_UPPER, lid_angle, timestamp); |
|
342 |
break; |
|
343 |
|
|
344 |
case(ICUB_ID_NECK_PAN): |
|
345 |
//PAN is inverted! |
|
346 |
JointInterface::store_incoming_position(ID_NECK_PAN, value, timestamp); |
|
347 |
break; |
|
348 |
|
|
349 |
case(ICUB_ID_NECK_TILT): |
|
350 |
JointInterface::store_incoming_position(ID_NECK_TILT, value, timestamp); |
|
351 |
break; |
|
352 |
|
|
353 |
case(ICUB_ID_NECK_ROLL): |
|
354 |
JointInterface::store_incoming_position(ID_NECK_ROLL, value, timestamp); |
|
355 |
break; |
|
356 |
|
|
357 |
case(ICUB_ID_EYES_BOTH_UD): |
|
358 |
JointInterface::store_incoming_position(ID_EYES_BOTH_UD, value, timestamp); |
|
359 |
break; |
|
360 |
|
|
361 |
//icub handles eyes differently, we have to set pan angle + vergence |
|
362 |
case(ICUB_ID_EYES_PAN): {//pan |
|
363 |
last_pos_eye_pan = value; |
|
364 |
float left = last_pos_eye_pan + last_pos_eye_vergence/2.0; |
|
365 |
float right = last_pos_eye_pan - last_pos_eye_vergence/2.0; |
|
366 |
|
|
367 |
//printf("> eye: pan=%3.2f vergence=%3.2f --> L=%3.2f R=%3.2f\n", last_pos_eye_pan, last_pos_eye_vergence, left, right); |
|
368 |
JointInterface::store_incoming_position(ID_EYES_LEFT_LR, left, timestamp); |
|
369 |
JointInterface::store_incoming_position(ID_EYES_RIGHT_LR, right, timestamp); |
|
370 |
break; |
|
371 |
} |
|
372 |
|
|
373 |
case(ICUB_ID_EYES_VERGENCE): { //vergence |
|
374 |
last_pos_eye_vergence = value; |
|
375 |
float left = last_pos_eye_pan + last_pos_eye_vergence/2.0; |
|
376 |
float right = last_pos_eye_pan - last_pos_eye_vergence/2.0; |
|
377 |
|
|
378 |
//printf("> eye: pan=%3.2f vergence=%3.2f --> L=%3.2f R=%3.2f\n", last_pos_eye_pan, last_pos_eye_vergence, left, right); |
|
379 |
JointInterface::store_incoming_position(ID_EYES_LEFT_LR, left, timestamp); |
|
380 |
JointInterface::store_incoming_position(ID_EYES_RIGHT_LR, right, timestamp); |
|
381 |
break; |
|
382 |
} |
|
383 |
} |
|
384 |
|
|
385 |
|
|
386 |
}*/ |
|
387 |
|
|
388 | 323 |
void iCubJointInterface::set_joint_enable_state(int e, bool enable) { |
389 | 324 |
int icub_jointid = -1; |
390 | 325 |
|
Also available in: Unified diff