17 #ifndef __ORIENTATION_THREAD_H__ 18 #define __ORIENTATION_THREAD_H__ 22 #include <yarp/os/RateThread.h> 23 #include <yarp/os/ResourceFinder.h> 24 #include <yarp/os/Time.h> 25 #include <yarp/dev/CartesianControl.h> 26 #include <yarp/dev/ControlBoardInterfaces.h> 27 #include <yarp/dev/PolyDriver.h> 28 #include <yarp/sig/Vector.h> 29 #include <yarp/sig/Matrix.h> 30 #include <yarp/math/Math.h> 32 #include <iCub/iKin/iKinFwd.h> 34 class OrientationThread :
public yarp::os::RateThread
46 yarp::dev::PolyDriver dCtrl;
47 yarp::dev::ICartesianControl *iCtrl;
48 yarp::dev::PolyDriver robotArm;
49 yarp::dev::PolyDriver robotTorso;
50 yarp::dev::IControlLimits *limTorso, *limArm;
52 iCub::iKin::iCubArm *arm;
53 iCub::iKin::iKinChain *chain;
55 yarp::sig::Vector eePos;
58 yarp::sig::Vector pointNormal;
59 yarp::sig::Vector center;
60 yarp::sig::Vector biggestAxis;
61 yarp::sig::Vector thetaMin, thetaMax;
62 yarp::sig::Matrix bestOrientation;
64 yarp::sig::Vector q, q0;
65 yarp::sig::Vector xdhat, odhat;
66 yarp::sig::Vector ones;
67 yarp::sig::Matrix Jacobian, mulJac;
68 yarp::sig::Vector angles;
70 void getAngles(yarp::sig::Vector &angles,
int factor);
71 bool normalDirection(std::string &hand, yarp::sig::Vector &normal);
76 ~OrientationThread() {};
78 bool open(std::string &name, std::string &arm, std::string &robot,
int &nAngles);
81 void setInfo(yarp::sig::Vector &eePos, yarp::sig::Vector &px, yarp::sig::Vector &py, yarp::sig::Vector &pointNormal, yarp::sig::Vector ¢er, yarp::sig::Vector &biggerAxis);
82 void getBestManip(
double &manip, yarp::sig::Matrix &orientation);
88 void postAskForPose();