Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

ArmMC.h

Go to the documentation of this file.
00001 
00002 //
00003 //       Title           : ArmMC.hpp
00004 //       Project         : D&D
00005 //       Created         : Thursday  August 1, 1996
00006 //       Author          : Mitch Pryor & Chetan Kapoor
00007 //       Platforms       : WIN32                        
00008 //       Copyright       : The University of Texas at Austin
00009 //                         All Rights Reserved.
00010 //       Access          : Company Confidential
00011 //       Purpose         : develop a class hierarchy for manual controllers             
00012 //
00013 //-------------------------------------------------------------------------
00014 //
00015 //       Classes:
00016 //               ArmMC
00017 //
00018 //       Global Functions:
00019 //               <none>
00020 //
00021 //       Global Variables:
00022 //               <none>
00023 //
00024 //-------------------------------------------------------------------------
00025 //
00026 //       $Revisions$
00027 //          Modified June 9, 1998 by Chalongrath Pholsiri
00028 //
00029 //       $Log: ArmMC.h,v $
00030 //       Revision 1.3  2005/03/14 21:54:05  pmarch
00031 //       Added to namespace OSCAR and removed "RR" from front of class names.
00032 //
00033 //       Revision 1.2  2004/05/27 19:24:07  pmarch
00034 //       Added /defgroup and /ingroup tags.
00035 //
00036 //       Revision 1.1  2003/08/18 21:23:29  pmarch
00037 //       Initial commit of ManualController
00038 //
00039 //
00041 
00042 #ifndef ArmMC_h
00043 #define ArmMC_h
00044 
00045 
00046 #include "AbsPosMC.h"
00047 #include "ForwardKinematics/FKPosition.h"
00048 #include "ForwardKinematics/FKJacobian.h"
00049 
00050 //void CALLBACK SetJointThread(UINT uID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2);
00051 
00053 namespace OSCAR {
00054 
00055   struct ControlParam
00056   {
00057           int joint, iter;
00058           double value, kp, kv, threshold;
00059 
00060   };
00061 
00066   class ArmMC : public AbsPosMC
00067   {
00068           public:
00069                   //constructors
00070                   ArmMC(const int numberOfButtons,
00071                   const int numberOfDeltas,
00072                   const HandPose& startingHand,
00073                       const Vector& scalingForces,
00074                       const Vector& maximumForces,
00075                           const String& nameOfDHFile,
00076                                   const String& nameOfMotorGainFile,
00077                   const String& name,
00078                                   MC_TYPE type);
00079                   
00080                   ArmMC(const int numberOfButtons,
00081                   const int numberOfDeltas,
00082                   const HandPose& startingHand,
00083                       const Vector& scalingForces,
00084                       const Vector& maximumForces,
00085                           const String& nameOfDHFile,
00086                   const String& name,
00087                                   MC_TYPE type);
00088 
00089                   //destuctor
00090                   virtual ~ArmMC();
00091                   
00092                   //public methods
00093                   void SetForces(Vector& forces);
00094                   void SetTorques(Vector& torques);
00095                   void SetScalingForces(Vector& scalingForces);
00096                   void SetMaximumForces(Vector& maximumForces);         
00097           
00098                   const void GetForces(Vector& forces);
00099                   const void GetAngles(Vector& angles);
00100                   const void GetScalingForces(Vector& scalingForces);
00101                   const void GetMaximumForces(Vector& maximumForces);
00102           const void GetTorques(Vector&);
00103           const int GetPCSDeltas(Vector&);
00104 
00105           int Initialize();
00106           int GetPacketFromMC();
00107           int SendPacketToMC();
00108           void SetArmPose(const Xform&);
00109                   virtual void GetAnglesFromMC() {};
00110                   
00111                   // Position control functions and members
00112   //            void SetJointAngle(int joint, int iter, double value, double kp, double kv, double threshold);
00113   //            void SetJointAngles(int iter, Vector& values, Vector& kps, Vector& kvs, Vector& thresholds);
00114                   double GetErrorRate(int joint);
00115                   const void GetErrorRates(Vector& speeds);
00116                   void UpdatePastErrorRates();
00117                   ControlParam  CParam;
00118                   Vector                *instErrorRates;
00119                   Vector                *prevErrors;
00120 
00121                   // Client-server related functions
00122                   int GetPacketFromServer();
00123                   int SendVoltagesToServer();
00124                   int Listen();
00125           
00126           protected:
00127                   //protected data members
00128           Vector                *forces;        // forces at EEF
00129           Vector                *scalingForces;
00130           Vector                *maximumForces;
00131       Vector            *torques;       // joint torques
00132           Vector                *voltages;
00133           FKJacobian    *jacobian;
00134           Xform                 handXform;
00135           Xform                 prevHandXform;
00136           Xform                 deltaXform;
00137     HandPose      previousHand;
00138           HandPose      deltaHand;
00139           Vector3               previousPosition;
00140   //    PCSHandPose   previousPCSHand;
00141       Vector            *angles;
00142       Vector            *PCSdeltas;
00143           MatrixData    *motorGainMD;
00144           Matrix                *motorGainMat;
00145           Matrix                *pastErrorRates;
00146           Vector                *accumErrors;
00147           int                           filterLength;
00148           
00149 
00150       // protected methods
00151     void CalculateDeltas();
00152       void CalculateTorques();
00153           virtual void CalculateVoltages();
00154       void CheckRotDeltas();
00155       virtual void SendVoltagesToMC() {};
00156           void ScaleDeltas();
00157 
00158           double CalcRate(int joint);
00159           double MaxVk(int joint);
00160           double MinVk(int joint);
00161   };
00162 
00163 }
00164 #endif //ArmMC_h
RRG Homepage OSCAR Overview OSCAR Tutorials Simulations