00001
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
00013 class PlanarThreeLinkArm : public IKSolver {
00014 public:
00015
00016 PlanarThreeLinkArm();
00017
00018
00019 PlanarThreeLinkArm(unsigned int offset);
00020
00021 using IKSolver::solve;
00022 using IKSolver::step;
00023
00024
00025
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;
00032
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
00050 float getL1() const;
00051 float getL2() const;
00052 float getL3() const;
00053
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
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