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 that 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) :
00014     IKSolver(), PTOL(posTolerance), OTOL(oriTolerance), QTOL(oriTolerance/50), MAX_ITER(iter) {}
00015 
00016   //! constructor
00017   IKGradientSolver(unsigned int iter, float posTolerance, float oriTolerance, float qTolerance) : 
00018     IKSolver(), PTOL(posTolerance), OTOL(oriTolerance), QTOL(qTolerance), MAX_ITER(iter) {}
00019   
00020   virtual bool solve(const Point& pEff, const Rotation& oriEff, KinematicJoint& j, 
00021          const Position& pTgt, float posPri, const Orientation& oriTgt, float oriPri) const;
00022 
00023   virtual bool solve(const Point& pEff, const Rotation& oriEff, KinematicJoint& j, 
00024          const Position& pTgt, float posPri, const Orientation& oriTgt, float oriPri, unsigned int root) const;
00025 
00026   using IKSolver::solve;
00027   
00028   virtual IKSolver::StepResult_t step(const Point& pEff, const Rotation& oriEff, KinematicJoint& j,
00029               const Position& pTgt, float pDist, float posPri, 
00030               const Orientation& oriTgt, float oriDist, float oriPri) const {
00031     return step(pEff,oriEff,j,pTgt,pDist,posPri,oriTgt,oriDist,oriPri,true);
00032   }
00033 
00034   virtual IKSolver::StepResult_t step(const Point& pEff, const Rotation& oriEff, KinematicJoint& j,
00035               const Position& pTgt, float pDist, float posPri, 
00036               const Orientation& oriTgt, float oriDist, float oriPri,
00037               bool successInReach) const;
00038   virtual IKSolver::StepResult_t step(const Point& pEff, const Rotation& oriEff, KinematicJoint& j,
00039               const Position& pTgt, float pDist, float posPri, 
00040               const Orientation& oriTgt, float oriDist, float oriPri,
00041               bool successInReach, unsigned int root) const;
00042   using IKSolver::step;
00043   
00044 protected:
00045   const float PTOL; //!< position tolerance
00046   const float OTOL; //!< orientation tolerance
00047   const float QTOL; //!< joint angle tolerance
00048   const unsigned int MAX_ITER; //!< maximum number of iterations to attempt
00049 private:
00050   //! holds the class name, set via registration with the DeviceDriver registry
00051   static const std::string autoRegisterIKGradientSolver;
00052   //! since this is the default solver, also register as "" (empty name)
00053   static const std::string autoRegisterDefaultIKSolver;
00054 };
00055 
00056 /*! @file
00057  * @brief Describes IKGradientSolver, which performs gradient descent on the joints to find a solution
00058  * @author Ethan Tira-Thompson (ejt) (Creator)
00059  */
00060 
00061 #endif

Tekkotsu v5.1CVS
Generated Mon May 9 04:58:42 2016 by Doxygen 1.6.3