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

IDLagrange.h

Go to the documentation of this file.
00001 
00002 //
00003 //      Title           : IDLagrange.h
00004 //      Project         : OSCAR Version 2.0
00005 //      Created         : Jun 30 14:05:48 1996
00006 //      Author          : Chetan Kapoor
00007 //      Platforms       : All
00008 //      Copyright       : Copyright© The University of Texas at Austin, 2002. All rights reserved.
00009 //                 
00010 //          This software and documentation constitute an unpublished work
00011 //          and contain valuable trade secrets and proprietary information
00012 //          belonging to the University. None of the foregoing material may be
00013 //          copied or duplicated or disclosed without the express, written
00014 //          permission of University. THE UNIVERSITY EXPRESSLY DISCLAIMS ANY
00015 //          AND ALL WARRANTIES CONCERNING THIS SOFTWARE AND DOCUMENTATION,
00016 //          INCLUDING ANY WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
00017 //          PARTICULAR PURPOSE, AND WARRANTIES OF PERFORMANCE, AND ANY WARRANTY
00018 //          THAT MIGHT OTHERWISE ARISE FROM COURSE OF DEALING OR USAGE OF TRADE.
00019 //          NO WARRANTY IS EITHER EXPRESS OR IMPLIED WITH RESPECT TO THE USE OF
00020 //          THE SOFTWARE OR DOCUMENTATION. Under no circumstances shall the
00021 //          University be liable for incidental, special, indirect, direct or
00022 //          consequential damages or loss of profits, interruption of business,
00023 //          or related expenses which may arise from use of software or documentation,
00024 //          including but not limited to those resulting from defects in software
00025 //          and/or documentation, or loss or inaccuracy of data of any kind.
00026 //
00027 //      Purpose         : Inverse Dynamics Using Tesar, Thomas formulation.
00028 //
00029 //----------------------------------------------------------------------------
00030 //
00031 //      $Revisions$
00032 //                      2/12/03 - Make it compatible with new InverseDynamics - Chalongrath Pholsiri
00033 //
00034 //      $Log: IDLagrange.h,v $
00035 //      Revision 1.5  2005/03/14 21:52:04  pmarch
00036 //      Added to namespace OSCAR and removed "RR" from front of class names.
00037 //
00038 //      Revision 1.4  2004/05/28 18:57:58  pmarch
00039 //      Added /defgroup and /ingroup tags.
00040 //
00041 //      Revision 1.3  2004/02/19 21:37:42  josh
00042 //      - Updated documentation.
00043 //
00044 //      Revision 1.2  2003/09/02 21:05:08  eswint
00045 //      - Reflects changes to Matrix v1.10
00046 //
00047 //      Revision 1.1  2003/08/18 21:17:50  josh
00048 //      Initial commit
00049 //
00050 //
00052 
00053 #ifndef IDLagrange_hpp
00054 #define IDLagrange_hpp
00055 
00056 #include "InverseDynamics.h"
00057 #include "Math/Tensor.h"
00058 #include "Math/Rot3by3.h"
00059 #include "Math/Matrix.h"
00060 #include "Math/Xform.h"
00061 
00063 namespace OSCAR {
00064 
00072   class IDLagrange : public InverseDynamics
00073   {
00074   
00075   public:
00128     IDLagrange(unsigned int DOF, const String& linkCGandMassFile, 
00129       const String& linkInertiaFile, 
00130       const Vector3D& gravity = Vector3D(0.0, 0.0, -9.8));
00131 
00148     IDLagrange(unsigned int DOF, const MatrixData& linkCGandMass, 
00149       const TensorData& linkInertia, 
00150       const Vector3D& gravity = Vector3D(0.0, 0.0, -9.8));
00151   
00152     virtual ~IDLagrange();
00153 
00163     bool SetGfunctions(const Tensor* tg, const Tensor* rg = 0);
00164 
00174     bool SetHfunctions(const TensorP* th, const TensorP* rh);
00175 
00182     bool        GetGravityTorques(Vector& gravityTorques);
00183 
00192     bool        GetVelocityTorques(const Vector& velocity, 
00193       Vector& torques);
00194 
00203     bool        GetAccelerationTorques(const Vector& acceleration, 
00204       Vector& torques);
00205 
00214     const Vector& GetJointTorques(const Vector& velocity,
00215                                     const Vector& acceleration,
00216                                     const HandPose& eefLoad = HandPose(0,0,0,0,0,0));
00217 
00222     const Matrix* GetInertiaMatrix();
00223 
00224   
00225     const Rot3by3* GetGlobalInertiaMatrices(const Xform* global_ts);
00226 
00236     const Matrix* GetIstar(const Xform* global_ts);
00237     const Tensor* GetIstarForEachLink(const Xform* global_ts);
00238     const Tensor* GetPstar();
00239     const Tensor* GetPstar(const Xform* global_ts);
00240     bool        GetAppliedLoadTorques(unsigned int linkNumber, const Tensor& gr, 
00241       const Tensor& gt,
00242       const Vector& link_load, 
00243       Vector& jnt_torques);
00244   protected:
00245   
00246     Rot3by3     *rotations;       // DOF X 3 X 3.  This will hold the
00247                             // 3 X 3 rotation matrices of each link
00248                             // with respect to the base
00249   
00250     Rot3by3     *rotations_trans; // DOF X 3 X 3.  This will hold the transpose
00251                                 // 3 X 3 rotation matrices of each link
00252                                 // with respect to the base
00253 
00254     Tensor      *global_inertia;  // DOF X 3 X 3.  This will hold the local
00255                                 // inertia tensors for each link defined
00256                                 // in the global frame
00257   
00258     Matrix      *Istar;           // DOF X DOF.  This will hold the equivalent
00259                           // inertia matrix
00260 
00261     Tensor  *linkIstars;// DOF X DOF X DOF This holds the equivalent 
00262                           // inertia matrix for each link in a Tensor
00263                           // This tensor is only filled when 'calculateIstarForEachLink'
00264                           // is called so that 'calculateIstar' may be optimized for speed.
00265   
00266     Tensor      *Pstar;           // DOF X DOF X DOF.  This will hold the
00267                           // inertia power modeling matrix
00268 
00269     const Tensor *trans_g;
00270     const Tensor *rot_g;
00271     const TensorP *trans_h;
00272     const TensorP *rot_h;
00273     bool        IstarUpdated, PstarUpdated, gravityUpdated;
00274   
00275     void        fillRotationMatrices(const Xform* global_ts);
00276     bool        calculateGlobalInertiaMatrices(const Xform* global_ts); 
00277     bool        calculateIstar();
00278     bool  calculateIstarForEachLink();
00279     bool        calculatePstar();
00280   
00281   private:
00282     IDLagrange(const IDLagrange&);
00283     IDLagrange& operator=(const IDLagrange&);
00284   };
00285 
00286   #include "Dynamics/IDLagrange.ipp"
00287 
00288 }
00289 
00290 #endif  // ifndef IDLagrange_hpp
RRG Homepage OSCAR Overview OSCAR Tutorials Simulations