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

IKJacobian.h

Go to the documentation of this file.
00001 
00002 //
00003 //      Title           : IKJacobian.h
00004 //      Project         : OSCAR
00005 //      Created         : Thu Nov 30 07:52:08 1995
00006 //      Author          : Chetan Kapoor & Peter March
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                 : Declares a Generalized Inverse class that uses the Jacobian inverse
00028 //                                                to compute an inverse position solution.  
00029 //
00030 //----------------------------------------------------------------------------
00031 //
00032 //      $Revisions$
00033 //
00034 //      $Log: IKJacobian.h,v $
00035 //      Revision 1.10  2007/02/09 22:47:56  chetan
00036 //      Some methods were not declared virtual
00037 //
00038 //      Revision 1.9  2005/03/14 21:53:30  pmarch
00039 //      Added to namespace OSCAR and removed "RR" from front of class names.
00040 //
00041 //      Revision 1.8  2005/01/11 16:08:09  pmarch
00042 //      Set default template parameter to FKJacobian and added additional commenting.
00043 //
00044 //      Revision 1.7  2005/01/10 18:53:59  chetan
00045 //      Fixed documentation
00046 //
00047 //      Revision 1.6  2005/01/10 17:35:58  pmarch
00048 //      Added template parameter to IKJacobian-based objects to allow user to supply custom forward kinematics object.
00049 //
00050 //      Revision 1.5  2004/07/29 20:15:52  chetan
00051 //      Minor changes to compile under g++ with -Wall and -pedantic warning flags enabled
00052 //
00053 //      Revision 1.4  2004/07/23 22:20:26  chetan
00054 //      Made changes to compile with Warning Level 4 and also under the latest C++ standard
00055 //
00056 //      Revision 1.3  2004/05/26 20:15:35  pmarch
00057 //      Added /defgroup and /ingroup tags.
00058 //
00059 //      Revision 1.2  2004/04/22 18:08:23  eswint
00060 //      - Changed constructor of IKJacobian to take const JointVector, reflected in changes to constructors for IKJReconfig & IKJAvoidLimits and IJKAvoidLimits::computeWeightingMatrix
00061 //
00062 //      Revision 1.1  2003/08/18 21:04:08  mtisius
00063 //      Initial commit of inverse kinematics
00064 //
00065 //
00067 #ifndef IKJacobian_hpp
00068 #define IKJacobian_hpp
00069 
00070 #include "Math/HandPose.h"
00071 #include "Math/EqnSolver.h"
00072 #include "ForwardKinematics/FKJacobian.h"
00073 #include "InverseKinematics/IKVelocity.h"
00074 
00076 namespace OSCAR {
00077 
00078   class DHData;
00079 
00093   template <class JacobianType=FKJacobian>
00094   class IKJacobian : public IKVelocity, IKPosition
00095   {
00096 
00097   public:
00098   
00121     IKJacobian(const JointVector& initialJointPosition, 
00122                   JacobianType* fkJacobian, 
00123                   OSCARError& err = DUMMY_ERROR(noError),
00124                   EqnSolver* solver = 0, double maxError = 0.1, 
00125                   double rtScale = 1000.0);
00126 
00133           IKJacobian(const IKJacobian& rhs);
00134 
00142     IKJacobian& operator=(const IKJacobian& rhs);
00143 
00149       virtual ~IKJacobian();
00150 
00165       virtual bool GetJointPosition(const Xform& desiredHandMatrix, JointVector& jointPosition);
00166     
00181       virtual bool GetJointPosition(const HandPose& desiredHand, JointVector& jointPosition);
00182 
00195       virtual bool GetJointVelocity(const HandPose& handVelocity, JointVector& jointVelocitySolution);
00196 
00206       virtual bool GetJointPosition(JointVector& jointPosition) const;  
00207     
00218       virtual bool SetJointPosition(const JointVector& jointPosition);
00219 
00229       void SetMinimumMOT(double minMOT);
00230 
00238       double GetMinimumMOT() const;
00239 
00248       void SetMaximumIterations(unsigned int noIterations);
00249 
00258       unsigned int GetMaximumIterations(void) const;
00259 
00273       bool SetErrorTolerance(double maxErrorVal, double rotScale);
00274 
00284       bool GetErrorTolerance(double& maxErrorVal, double& rotScale) const;
00285 
00294       double GetSolutionProperties(void) const;
00295 
00307       double GetSolutionProperties(unsigned int& iterationCount) const;
00308 
00320       double GetSolutionProperties(double& errorMagnitude) const;
00321 
00334       double GetSolutionProperties(Matrix& jacobian) const;
00335 
00347       double GetSolutionProperties(Xform& currentHandPos) const;
00348     
00349   protected:
00350 
00351       unsigned int    DOF;
00352       unsigned int    maxIterations;
00353       unsigned int    currentIteration;     //these are intended to be used in converge
00354       double                        maxError;
00355       double                        rotationScale;
00356       double                        minimumMOT;
00357       double          MOT;
00358       double            errorMag;
00359       Xform         desiredXform;
00360 
00361       JointVector         *currentJointVector;
00362       JointVector         *previousJointVector;
00363       JointVector         *initialJointVector;
00364       JointVector         *differentialJointVector;
00365       JointVector         *jointVelocity;
00366     
00367       HandPose      errorHandVector;
00368       const Xform   *currentHand;
00369       const Matrix      *currentJacobian;
00370       JacobianType   *fowkin;
00371       EqnSolver     *solver;
00372     
00373       virtual bool      converge(const Xform& desiredHandMatrix);
00374 
00375       virtual double    calculateErrorMagnitude(const Xform& desired, 
00376                                                 const Xform* current, 
00377                                                 HandPose& error);
00378       virtual void      updateKinematicState(JointVector& jointPosition);
00379       virtual bool      inverse();
00380 
00381 
00382       bool internalSolverFlag;
00383   };
00384 
00385   #include "InverseKinematics/IKJacobian.ipp"
00386 
00387 }
00388 #endif  // IKJacobian_hpp
RRG Homepage OSCAR Overview OSCAR Tutorials Simulations