Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages | Examples

aibohead.h

Go to the documentation of this file.
00001 // ***************************************************************************
00002 //                           aibohead.h
00003 //
00004 //    copyright            : (C) 2003 by tbaier
00005 //    email                : tbaier@informatik.uni-hamburg.de
00006 // ***************************************************************************
00007 #ifndef AIBOHEAD_H
00008 #define AIBOHEAD_H
00009 
00010 #include "aibojoint.h"
00011 
00013 enum HEAD_JOINT{
00014     HT, 
00015     HP, 
00016     HR, 
00017 };
00018 
00019 
00021 static const char* const HEAD_JOINT_ARRAY[] = {
00022   //Head Joints
00023   "PRM:/r1/c1-Joint2:j1",             
00024   "PRM:/r1/c1/c2-Joint2:j2",          
00025   "PRM:/r1/c1/c2/c3-Joint2:j3",       
00026 };
00027 
00029 static const int    NUM_HEAD_JOINTS = 3;
00030 
00031 
00053 class AiboHead : public  AiboJoint {
00054 
00055   
00056  public:
00057  
00059   AiboHead();
00060   
00062   virtual ~AiboHead(){};
00063 
00064   
00068   
00070   void OpenPrimitives();
00075   OPrimitiveID GetJointID(const HEAD_JOINT j) const;
00077   
00078 
00082   
00085   void NewCommandVectorData();
00087   
00091 
00092  
00098   void SetJoint(const slongword angle, 
00099                 const HEAD_JOINT joint,
00100                 const int cmdVecIndex);
00101 
00109   void SetJoint(const slongword angle, 
00110                 const HEAD_JOINT joint,
00111                 const int numFrames,
00112                 const int cmdVecIndex);
00113 
00119   void SetJoint(const double angle,
00120                 const HEAD_JOINT joint,
00121                 const int cmdVecIndex);
00122 
00123 
00131   void SetJoint(const double angle, 
00132                 const HEAD_JOINT joint,
00133                 const int numFrames,
00134                 const int cmdVecIndex);
00135 
00142   void SetJoint(const double start, const double angle, 
00143                 const HEAD_JOINT joint,
00144                 const int cmdVecIndex);
00145 
00146 
00155   void SetJoint(const double start, const double angle, 
00156                 const HEAD_JOINT joint,
00157                 const int numFrames,
00158                 const int cmdVecIndex);
00159 
00160 
00166   void SetJointRel(const slongword angle,
00167                    const HEAD_JOINT joint, 
00168                    const int cmdVecIndex);
00169   
00177   void SetJointRel(const slongword angle, 
00178                    const HEAD_JOINT joint,
00179                    const int numFrames,
00180                    const int cmdVecIndex);
00181 
00187   void SetJointRel(const double angle, 
00188                    const HEAD_JOINT joint,
00189                    const int cmdVecIndex);
00190   
00198   void SetJointRel(const double angle, 
00199                    const HEAD_JOINT joint,
00200                    const int numFrames,
00201                    const int cmdVecIndex);
00202 
00203 
00210   void SetJointRel(const double start, const double angle, 
00211                    const HEAD_JOINT joint,
00212                    const int cmdVecIndex);
00213   
00222   void SetJointRel(const double start, const double angle, 
00223                    const HEAD_JOINT joint,
00224                    const int numFrames,
00225                    const int cmdVecIndex);
00226 
00227 
00229 
00237   double GetJointValue(const HEAD_JOINT joint) const;
00238 
00244   double GetOPENRJointValue(const HEAD_JOINT joint) const;
00245     
00246   double GetMaxJointValue(const int index, JOINT_UNIT unit = ANGLE_RAD) const;
00247 
00251   double GetMaxJointValue(const HEAD_JOINT joint, JOINT_UNIT unit = ANGLE_RAD) const;
00252 
00253 
00254   double GetMinJointValue(const int index, JOINT_UNIT unit = ANGLE_RAD) const;
00255 
00259   double GetMinJointValue(const HEAD_JOINT joint, JOINT_UNIT unit = ANGLE_RAD) const;
00260 
00261 
00262   double GetMaxJointVelocity(const int index, JOINT_UNIT unit = ANGLE_RAD) const;
00266   double GetMaxJointVelocity(const HEAD_JOINT joint, JOINT_UNIT unit = ANGLE_RAD) const;
00268   
00269 
00273   void SetJointGain();
00274 
00275   void EnableJointGain(const HEAD_JOINT joint);
00276     
00277   void DisableJointGain(const HEAD_JOINT joint);
00278 
00280 
00281 
00282  protected:
00283       
00286   static const word   HT_PGAIN = 0x000a;
00288   static const word   HT_IGAIN = 0x0008;
00290   static const word   HT_DGAIN = 0x000c;
00291   
00293   static const word   HP_PGAIN = 0x000d;
00295   static const word   HP_IGAIN = 0x0008;
00297   static const word   HP_DGAIN = 0x000b;
00298   
00300   static const word   HR_PGAIN = 0x000a;
00302   static const word   HR_IGAIN = 0x0008;
00304   static const word   HR_DGAIN = 0x000c;
00305 
00306 
00310   static const double MAX_TILT_DEG        =  46.0; 
00314   static const double MIN_TILT_DEG        = -91.5;
00315  
00316 
00320   static const double MAX_ROLL_DEG        =  32.0;
00324   static const double MIN_ROLL_DEG        = -32.0;
00325 
00326 
00330   static const double MAX_PAN_DEG         =  92.6;
00334   static const double MIN_PAN_DEG         = -92.6;
00335   
00336 
00337 
00341   static const double MAX_TILT            =  MAX_TILT_DEG * DEGTORAD;
00345   static const double MIN_TILT            =  MIN_TILT_DEG * DEGTORAD;
00346 
00350   static const double MAX_ROLL            =  MAX_ROLL_DEG * DEGTORAD;
00354   static const double MIN_ROLL            =  MIN_ROLL_DEG * DEGTORAD;
00355 
00359   static const double MAX_PAN             =  MAX_PAN_DEG * DEGTORAD;
00363   static const double MIN_PAN             =  MIN_PAN_DEG * DEGTORAD;
00364   
00365   
00366   // .../2.0 because values are from open-r FAQ and
00367   // belong to std masterstudio commands where 1 
00368   // frame is 16ms
00369   
00373   static const double MAX_TILT_VELO_DEG   = 1.93/2.0;
00377   static const double MAX_ROLL_VELO_DEG   = 2.76/2.0;
00381   static const double MAX_PAN_VELO_DEG    = 2.76/2.0;
00382   
00386   static const double MAX_TILT_VELO       = MAX_TILT_VELO_DEG * DEGTORAD;
00390   static const double MAX_ROLL_VELO       = MAX_ROLL_VELO_DEG * DEGTORAD;
00394   static const double MAX_PAN_VELO        = MAX_PAN_VELO_DEG * DEGTORAD;
00395   
00396 };
00397 
00398 
00399 // ******************************************
00400 // **                                      **
00401 // ******************************************
00402 inline void AiboHead::EnableJointGain(const HEAD_JOINT joint)
00403 {
00404     AiboJoint::EnableJointGain(JointID[joint]);
00405 };
00406     
00407 
00408 // ******************************************
00409 // **                                      **
00410 // ******************************************
00411 inline void AiboHead::DisableJointGain(const HEAD_JOINT joint)
00412 {
00413     AiboJoint::DisableJointGain(JointID[joint]);
00414 };
00415 
00416 
00417 // ******************************************
00418 // **                                      **
00419 // ******************************************
00420 inline void AiboHead::SetJoint(const slongword angle, 
00421                                const HEAD_JOINT joint,
00422                                const int cmdVecIndex)
00423 { 
00424   AiboJoint::SetJointRel(JointValues[joint], (double)angle/MICRO, 
00425                          JointID[joint], joint, 
00426                          cmdVecIndex);
00427 };
00428 
00429 
00430 // ******************************************
00431 // **                                      **
00432 // ******************************************
00433 inline void AiboHead::SetJoint(const slongword angle, 
00434                                const HEAD_JOINT joint,
00435                                const int numFrames,
00436                                const int cmdVecIndex)
00437 { 
00438   AiboJoint::SetJointRel(JointValues[joint], (double)angle/MICRO, 
00439                          JointID[joint], joint, 
00440                          numFrames, cmdVecIndex);
00441 };
00442 
00443 
00444 // ******************************************
00445 // **                                      **
00446 // ******************************************
00447 inline void AiboHead::SetJoint(const double angle,
00448                                const HEAD_JOINT joint,
00449                                const int cmdVecIndex)
00450 { 
00451   AiboJoint::SetJoint(JointValues[joint], angle,
00452                       JointID[joint], joint,
00453                       cmdVecIndex);
00454 };
00455 
00456 
00457 // ******************************************
00458 // **                                      **
00459 // ******************************************
00460 inline void AiboHead::SetJoint(const double angle,
00461                                const HEAD_JOINT joint,
00462                                const int numFrames,
00463                                const int cmdVecIndex)
00464 { 
00465   AiboJoint::SetJoint(JointValues[joint], angle,
00466                       JointID[joint], joint,
00467                       numFrames,
00468                       cmdVecIndex);
00469 };
00470 
00471 
00472 // ******************************************
00473 // **                                      **
00474 // ******************************************
00475 inline void AiboHead::SetJoint(const double start, const double angle, 
00476                                const HEAD_JOINT joint,
00477                                const int cmdVecIndex)
00478 { 
00479   AiboJoint::SetJoint(start, angle, 
00480                       JointID[joint], joint, 
00481                       cmdVecIndex);
00482 };
00483 
00484 
00485 // ******************************************
00486 // **                                      **
00487 // ******************************************
00488 inline void AiboHead::SetJoint(const double start, const double angle, 
00489                                const HEAD_JOINT joint,
00490                                const int numFrames,
00491                                const int cmdVecIndex)
00492 { 
00493   AiboJoint::SetJoint(start, angle, 
00494                       JointID[joint], joint, 
00495                       numFrames,
00496                       cmdVecIndex);
00497 };
00498 
00499 
00500 // ******************************************
00501 // **                                      **
00502 // ******************************************
00503 inline void AiboHead::SetJointRel(const slongword angle,
00504                                   const HEAD_JOINT joint,
00505                                   const int cmdVecIndex)
00506 { 
00507   AiboJoint::SetJointRel(JointValues[joint], ((double)angle)/MICRO, 
00508                           JointID[joint], joint, 
00509                           cmdVecIndex);
00510 
00511 };
00512 
00513 
00514 // ******************************************
00515 // **                                      **
00516 // ******************************************
00517 inline void AiboHead::SetJointRel(const slongword angle,
00518                                   const HEAD_JOINT joint,
00519                                   const int numFrames,
00520                                   const int cmdVecIndex)
00521 { 
00522   AiboJoint::SetJointRel(JointValues[joint], ((double)angle)/MICRO, 
00523                          JointID[joint], joint, 
00524                          numFrames,
00525                          cmdVecIndex);
00526 };
00527 
00528 
00529 // ******************************************
00530 // **                                      **
00531 // ******************************************
00532 inline void AiboHead::SetJointRel(const double angle, 
00533                                   const HEAD_JOINT joint,
00534                                   const int cmdVecIndex)
00535 { 
00536   AiboJoint::SetJointRel(JointValues[joint], angle, 
00537                          JointID[joint], joint, 
00538                          cmdVecIndex);
00539 
00540 };
00541 
00542 
00543 // ******************************************
00544 // **                                      **
00545 // ******************************************
00546 inline void AiboHead::SetJointRel(const double angle, 
00547                                   const HEAD_JOINT joint,
00548                                   const int numFrames,
00549                                   const int cmdVecIndex)
00550 { 
00551   AiboJoint::SetJointRel(JointValues[joint], angle, 
00552                          JointID[joint], joint,
00553                          numFrames,
00554                          cmdVecIndex);
00555 
00556 };
00557 
00558 
00559 // ******************************************
00560 // **                                      **
00561 // ******************************************
00562 inline void AiboHead::SetJointRel(const double start, const double angle, 
00563                                   const HEAD_JOINT joint,
00564                                   const int cmdVecIndex)
00565 { 
00566   AiboJoint::SetJointRel(start, angle, 
00567                          JointID[joint], joint, 
00568                          cmdVecIndex);
00569 
00570 };
00571 
00572 
00573 // ******************************************
00574 // **                                      **
00575 // ******************************************
00576 inline void AiboHead::SetJointRel(const double start, const double angle, 
00577                                   const HEAD_JOINT joint,
00578                                   const int numFrames,
00579                                   const int cmdVecIndex)
00580 { 
00581   AiboJoint::SetJointRel(start, angle, 
00582                          JointID[joint], joint,
00583                          numFrames,
00584                          cmdVecIndex);
00585 
00586 };
00587 
00588 
00589 // ******************************************
00590 // **                                      **
00591 // ******************************************
00592 inline double AiboHead::GetJointValue(const HEAD_JOINT joint) const
00593 {
00594   return JointValues[joint];
00595 };
00596 
00597 
00598 // ******************************************
00599 // **                                      **
00600 // ******************************************
00601 inline double AiboHead::GetOPENRJointValue(const HEAD_JOINT joint) const
00602 {
00603   return AiboJoint::GetOPENRJointValue(JointID[joint]);
00604 };
00605 
00606 
00607 // ******************************************
00608 // **                                      **
00609 // ******************************************
00610 inline OPrimitiveID AiboHead::GetJointID(const HEAD_JOINT j) const
00611 {
00612   return JointID[j];
00613 };
00614 
00615 
00616 // ******************************************
00617 // **                                      **
00618 // ******************************************
00619 inline double AiboHead::GetMaxJointValue(const int index,JOINT_UNIT unit) const
00620 {
00621   return GetMaxJointValue(HEAD_JOINT(index), unit);
00622 };
00623 
00624 
00625 // ******************************************
00626 // **                                      **
00627 // ******************************************
00628 inline double AiboHead::GetMinJointValue(const int index,JOINT_UNIT unit) const
00629 {
00630   return GetMinJointValue(HEAD_JOINT(index), unit);
00631 };
00632 
00633 
00634 // ******************************************
00635 // **                                      **
00636 // ******************************************
00637 inline double AiboHead::GetMaxJointVelocity(const int index, JOINT_UNIT unit) const
00638 {
00639   return GetMaxJointVelocity(HEAD_JOINT(index), unit);
00640 };
00641 
00642 
00643 #endif // define AIBOHEAD_H


tams Tim Baier AiboLib v0.2.4
Generated Thu Jan 19 11:54:29 2006 by doxygen 1.4.3