Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

PlanarThreeLinkArm.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef INCLUDED_PlanarThreeLinkArm_h_
00003 #define INCLUDED_PlanarThreeLinkArm_h_
00004 
00005 #ifdef TGT_IS_HANDEYE
00006 
00007 #include "Motion/IKSolver.h"
00008 #include "Shared/fmatCore.h"
00009 #include "Motion/Kinematics.h"
00010 #include "Shared/RobotInfo.h"
00011 
00012 //! Kinematics solver for an arm composed of three consecutive joints in the same plane
00013 class PlanarThreeLinkArm : public IKSolver {
00014 public:
00015   //! Constructor: use the last three links in the chain
00016   PlanarThreeLinkArm();
00017   
00018   //! Constructor: @offset specifies the first joint in the chain
00019   PlanarThreeLinkArm(unsigned int offset);
00020   
00021   using IKSolver::solve;
00022   using IKSolver::step;
00023   
00024   //! Solve to get an 'effector' (@a pEff, @a oriEff, relative to link following @a j) to a solution of @a pTgt, @a oriTgt (or at least a local minimum)
00025   /*! @a posPri and @a oriPri specify relative weighting of each solution in case they are mutually exclusive */
00026   virtual bool solve(const Point& pEff, const Rotation& oriEff, KinematicJoint& j, const Position& pTgt, float posPri, const Orientation& oriTgt, float oriPri) const;
00027   virtual 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; 
00028   
00029   struct Solutions {
00030     Solutions() : angles(),noSols(),valid() {}
00031     fmat::Matrix<2,3> angles; // double check all references to Solutions.angles
00032     //fmat::Matrix<3,2> angles;  // This is what is should be!
00033     int noSols;
00034     bool valid;
00035   };
00036   
00037   void PrintVariables() const;
00038   PlanarThreeLinkArm::Solutions solveWithOffset(float x, float y, float pref_phi, fmat::Column<3> baseOffset = fmat::pack(0.0f, 0.0f,1.0f)) const;
00039   PlanarThreeLinkArm::Solutions invKin3LinkRelaxPhi(float x, float y, float pref_phi) const;
00040   PlanarThreeLinkArm::Solutions nearConfig(PlanarThreeLinkArm::Solutions sol, float elbow, bool valid) const;
00041   PlanarThreeLinkArm::Solutions punt(float x, float y) const;
00042   PlanarThreeLinkArm::Solutions validAngles(PlanarThreeLinkArm::Solutions solutions) const;
00043   PlanarThreeLinkArm::Solutions invKin3Link(float x,float y,float phi) const;
00044   fmat::Matrix<2,2> invKin2Link(float x,float y,float link1,float link2) const;
00045   PlanarThreeLinkArm::Solutions invKin2Link(float x,float y) const;
00046   float angDist(float a1,float a2) const;
00047   float angNorm(float a) const;
00048   fmat::Matrix<2,2> rot(float t) const;
00049   //get Joint lengths 
00050   float getL1() const;
00051   float getL2() const;
00052   float getL3() const;
00053   //set Joint lengths
00054   void setL1(float length1, float jointMax, float jointMin);
00055   void setL2(float length2, float jointMax, float jointMin);
00056   void setL3(float length3, float jointMax, float jointMin);
00057   
00058 private:
00059   //! holds the class name, set via registration with the DeviceDriver registry
00060   static const std::string autoRegisterPlanarThreeLinkArm;
00061   float L1, L2, L3;
00062   float jointLimits[3][2];
00063 };
00064 
00065 #endif  // TGT_IS_HANDEYE
00066 
00067 #endif

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