Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

IKGradientSolver.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef INCLUDED_IKGradientSolver_h_
00003 #define INCLUDED_IKGradientSolver_h_
00004 
00005 #include "IKSolver.h"
00006 
00007 //! Performs gradient descent on the joints to find a solution
00008 /*! This is intended as a generic fallback for IK requests which cannot
00009  *  be handled analytically. */
00010 class IKGradientSolver : public IKSolver {
00011 public:
00012   //! constructor
00013   IKGradientSolver(unsigned int iter=75, float posTolerance=0.5f, float oriTolerance=.001f) : IKSolver(), PTOL(posTolerance), OTOL(oriTolerance), QTOL(oriTolerance/50), MAX_ITER(iter) {}
00014   //! constructor
00015   IKGradientSolver(unsigned int iter, float posTolerance, float oriTolerance, float qTolerance) : IKSolver(), PTOL(posTolerance), OTOL(oriTolerance), QTOL(qTolerance), MAX_ITER(iter) {}
00016   
00017   virtual bool solve(const Point& pEff, const Rotation& oriEff, KinematicJoint& j, const Position& pTgt, float posPri, const Orientation& oriTgt, float oriPri) const;
00018   using IKSolver::solve;
00019   
00020   virtual IKSolver::StepResult_t step(const Point& pEff, const Rotation& oriEff, KinematicJoint& j, const Position& pTgt, float pDist, float posPri, const Orientation& oriTgt, float oriDist, float oriPri) const {
00021     return step(pEff,oriEff,j,pTgt,pDist,posPri,oriTgt,oriDist,oriPri,true);
00022   }
00023   virtual IKSolver::StepResult_t step(const Point& pEff, const Rotation& oriEff, KinematicJoint& j, const Position& pTgt, float pDist, float posPri, const Orientation& oriTgt, float oriDist, float oriPri, bool successInReach) const;
00024   using IKSolver::step;
00025   
00026 protected:
00027   const float PTOL; //!< position tolerance
00028   const float OTOL; //!< orientation tolerance
00029   const float QTOL; //!< joint angle tolerance
00030   const unsigned int MAX_ITER; //!< maximum number of iterations to attempt
00031   
00032 private:
00033   //! holds the class name, set via registration with the DeviceDriver registry
00034   static const std::string autoRegisterIKGradientSolver;
00035   //! since this is the default solver, also register as "" (empty name)
00036   static const std::string autoRegisterDefaultIKSolver;
00037 };
00038 
00039 /*! @file
00040  * @brief Describes IKGradientSolver, which performs gradient descent on the joints to find a solution
00041  * @author Ethan Tira-Thompson (ejt) (Creator)
00042  */
00043 
00044 #endif

Tekkotsu v5.1CVS
Generated Fri Mar 16 05:26:41 2012 by Doxygen 1.6.3