SerialChain* chain = SerialChain("MY_KINEMATICS",0,2);
chain->addJoint( new JointTransX(Frame::Identity()));
chain->addJoint( new JointTransY(Frame::Identity()));
setLastJointToEE(Frame(Rotation::Identity(),Vector(0,0,0.5)));
class User {
Jnt2CartPos* jnt2cartpos;
std::vector<double> q;
Frame F_base_ee;
public:
User(KinematicFamily* kin) :
jnt2cartpos(kin->createJnt2CartPos()),
q(kin->nrOfJoints())
{
if (jnt2cartpos==0) {
// a Jnt2CartPos instance does not exist for this kinematic family.
}
}
~User() {
delete jnt2cartpos;
}
void calculate() {
int result = jnt2cartpos->evaluate(q);
if (result !=0) {
// could not calculate the transformation..
}
jnt2cartpos->getFrame(0,F_base_ee);
}
}
1.4.7