BHand.h
Go to the documentation of this file.
00001 /* Allegro, Copyright 2012 SimLab Co., Ltd. All rights reserved.
00002  *
00003  * This library is commercial and cannot be redistributed, and/or modified
00004  * WITHOUT ANY ALLOWANCE OR PERMISSION OF SimLab Co., LTD.
00005  */
00006 
00028 #ifndef __BHAND_H__
00029 #define __BHAND_H__
00030 
00031 #include "BHandDef.h"
00032 
00033 #define NOF 4 // number of fingers
00034 #define NOJ 4 // number of joints in each finger
00035 #define SIZEOF_VARRAY (NOF*NOJ*8)
00036 
00041 enum eMotionType
00042 {
00043         eMotionType_NONE,                               
00044         eMotionType_HOME,                               
00045         eMotionType_READY,                              
00046         eMotionType_PRE_SHAPE,                  
00047         eMotionType_GRASP_3,                    
00048         eMotionType_GRASP_4,                    
00049         eMotionType_PINCH_IT,                   
00050         eMotionType_PINCH_MT,                   
00051         eMotionType_OBJECT_MOVING,              
00052         eMotionType_ENVELOP,                    
00053         eMotionType_JOINT_PD,                   
00054         NUMBER_OF_MOTION_TYPE
00055 };
00056 
00061 enum eHandType
00062 {
00063         eHandType_Left = 0,                             
00064         eHandType_Right                                 
00065 };
00066 
00072 class BHANDEXPORT BHand
00073 {
00074 public:
00075         BHand(eHandType ht);
00076         ~BHand(void);
00077 
00083         eHandType GetType();
00084 
00090         void SetTimeInterval(double dT);
00091 
00097         void SetMotionType(int motionType);
00098 
00106         void SetJointPosition(double* q);
00107 
00113         void UpdateControl(double time);
00114 
00120         void GetJointTorque(double* tau);
00121 
00128         void GetFKResult(double x[4], double y[4], double z[4]);
00129 
00134         void SetJointDesiredPosition(double* q);
00135 
00141         void SetGainsEx(double* kp, double* kd);
00142 
00147         void SetGraspingForce(double f[4]);
00148 
00155         void GetGraspingForce(double fx[4], double fy[4], double fz[4]);
00156 
00157 private:
00158         BHand();
00159         void SetGains(int motionType);
00160         void SolveFK();
00161         void SolveFKLeft();
00162         void SolveFKRight();
00163         void CalculateJacobian();
00164         //void CalculateJacobianLeft();
00165         //void CalculateJacobianRight();
00166         void CalculateGravity();
00167         //void CalculateGravityLeft();
00168         //void CalculateGravityRight();
00169 
00170         void Motion_HomePosition();
00171         void Motion_Ready();
00172         void Motion_PreShape();
00173         void Motion_Grasp3();
00174         void Motion_Grasp4();
00175         void Motion_PinchIT();
00176         void Motion_PinchMT();
00177         void Motion_ObjectMoving();
00178         void Motion_Envelop();
00179         void Motion_JointPD();
00180 
00181 private:
00182         double _dT;                                                     
00183         double _curT;
00184         
00185         eHandType _handType;                            
00186         eMotionType _motionType;                        
00187         
00188         double _q[NOF][NOJ];                            
00189         double _q_filtered[NOF][NOJ];           
00190         double _q_pre[NOF][NOJ];                        
00191         double _q_filtered_pre[NOF][NOJ];       
00192         double _qdot[NOF][NOJ];                         
00193         double _qdot_filtered[NOF][NOJ];        
00194         double _qdot_pre[NOF][NOJ];                     
00195         double _tau_des[NOF][NOJ];                      
00196         double _q_des[NOF][NOF];                        
00197 
00198         double _kp[NOF][NOJ];                           
00199         double _kd[NOF][NOJ];                           
00200         double _kp_task[NOF][NOJ];                      
00201         double _kd_task[NOF][NOJ];                      
00202 
00203         double _x[NOF];                                         
00204         double _y[NOF];                                         
00205         double _z[NOF];                                         
00206         double _x_filtered[NOF];                        
00207         double _y_filtered[NOF];                        
00208         double _z_filtered[NOF];                        
00209         double _x_pre[NOF];                                     
00210         double _y_pre[NOF];                                     
00211         double _z_pre[NOF];                                     
00212         double _x_filtered_pre[NOF];            
00213         double _y_filtered_pre[NOF];            
00214         double _z_filtered_pre[NOF];            
00215         
00216         double _xdot[NOF];                                      
00217         double _ydot[NOF];                                      
00218         double _zdot[NOF];                                      
00219         double _xdot_filtered[NOF];                     
00220         double _ydot_filtered[NOF];                     
00221         double _zdot_filtered[NOF];                     
00222         double _xdot_pre[NOF];                          
00223         double _ydot_pre[NOF];                          
00224         double _zdot_pre[NOF];                          
00225 
00226         double _J[NOF][3][NOJ];                         
00227 
00228         double _G[NOF][NOJ];                            
00229 
00230         double _f_des[NOF];                                     
00231 
00232         double _x_des[NOF];                                     
00233         double _y_des[NOF];                                     
00234         double _z_des[NOF];                                     
00235 
00236         double S1_C[NOJ], S2_C[NOJ], S3_C[NOJ], S4_C[NOJ], S23_C[NOJ], S234_C[NOJ], S34_C[NOJ];
00237         double C1_C[NOJ], C2_C[NOJ], C3_C[NOJ], C4_C[NOJ], C23_C[NOJ], C234_C[NOJ], C34_C[NOJ];
00238 
00239         double _mass[NOF][NOJ];                         
00240 };
00241 
00242 BHAND_EXTERN_C_BEGIN
00243 
00247 BHANDEXPORT BHand* bhCreateLeftHand();
00248 
00252 BHANDEXPORT BHand* bhCreateRightHand();
00253 
00254 BHAND_EXTERN_C_END
00255 
00256 #endif // __BHAND_H__
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


AllegroHand
Author(s): Alex Alspach (SimLab), Seungsu Kim (EPFL)
autogenerated on Thu Mar 21 2013 21:24:05