30int main(
int argc,
char *argv[])
33 rf.configure(argc, argv);
36 cout <<
"Options:" << endl;
37 cout <<
"--kinematics eye|arm|leg" << endl;
38 cout <<
"--type left|right|left_v2|..." << endl;
39 cout <<
"--q \"(1.0 ... n)\"" << endl;
43 string kinematics = rf.check(
"kinematics", Value(
"eye")).asString();
44 string type = rf.check(
"type", Value(
"left")).asString();
46 transform(kinematics.begin(), kinematics.end(), kinematics.begin(), ::tolower);
47 transform(type.begin(), type.end(), type.begin(), ::tolower);
49 if ((kinematics !=
"eye") && (kinematics !=
"arm") && (kinematics !=
"leg"))
51 cerr <<
"unrecognized kinematics \"" << kinematics <<
"\"" << endl;
55 unique_ptr<iKinLimb> limb;
56 if (kinematics ==
"eye")
58 limb = unique_ptr<iKinLimb>(
new iCubEye(type));
60 else if (kinematics ==
"arm")
62 limb = unique_ptr<iKinLimb>(
new iCubArm(type));
66 limb = unique_ptr<iKinLimb>(
new iCubLeg(type));
69 cout <<
"Asked for type \"" << type <<
"\"" << endl;
70 cout <<
"Type used \"" << limb->getType() <<
"\"" << endl;
74 for (
size_t i = 0; i < chain->
getN(); i++)
79 Vector q(chain->
getN(), 0.0);
80 if (Bottle *b = rf.find(
"q").asList())
82 size_t len = std::min(q.length(), (
size_t)b->size());
83 for (
size_t i = 0; i < len; i++)
85 q[i] = b->get(i).asFloat64();
89 Matrix
H = chain->
getH((
M_PI / 180.0) * q);
91 cout <<
"kinematics=\"" << kinematics <<
"/" << type <<
"\"" << endl;
92 cout <<
"q=(" << ((180.0 /
M_PI) * chain->
getAng()).toString(5, 5) <<
")" << endl;
93 cout <<
"H=" << endl <<
H.toString(5, 5) << endl;