20 #include <yarp/os/all.h>
21 #include <yarp/sig/all.h>
25 using namespace yarp::os;
26 using namespace yarp::sig;
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;
93 cout <<
"H=" << endl <<
H.toString(5, 5) << endl;
A class for defining the iCub Arm.
A class for defining the iCub Eye.
A class for defining the iCub Leg.
A Base class for defining a Serial Link Chain.
yarp::sig::Matrix getH(const unsigned int i, const bool allLink=false)
Returns the rigid roto-translation matrix from the root reference frame to the ith frame in Denavit-H...
bool releaseLink(const unsigned int i)
Releases the ith Link.
yarp::sig::Vector getAng()
Returns the current free joint angles values.
unsigned int getN() const
Returns the number of Links belonging to the Chain.
void setAllConstraints(bool _constrained)
Sets the constraint status of all chain links.
int main(int argc, char *argv[])
std::string toString(const T &t)