diff --git a/include/sot-dynamic/dynamic-hrp2.h b/include/sot-dynamic/dynamic-hrp2.h index 2a4d139..a8781ca 100644 --- a/include/sot-dynamic/dynamic-hrp2.h +++ b/include/sot-dynamic/dynamic-hrp2.h @@ -30,7 +30,7 @@ #include <sot-dynamic/dynamic.h> /* JRL dynamic */ -#include <hrp2Dynamics/hrp2Opthumanoid-dynamic-robot.hh> +#include <hrp2-dynamics/hrp2OptHumanoidDynamicRobot.h> /* --------------------------------------------------------------------- */ /* --- API ------------------------------------------------------------- */ diff --git a/src/dynamic.cpp b/src/dynamic.cpp index 679b4fd..ba29c7a 100644 --- a/src/dynamic.cpp +++ b/src/dynamic.cpp @@ -662,7 +662,11 @@ computeJcom( ml::Matrix& Jcom,int time ) { sotDEBUGIN(25); newtonEulerSINTERN(time); - Jcom.initFromMotherLib(m_HDR->jacobianCenterOfMass()); + + matrixNxP jacobian; + m_HDR->getJacobianCenterOfMass(*m_HDR->rootJoint(), jacobian); + + Jcom.initFromMotherLib(jacobian); sotDEBUGOUT(25); return Jcom; } @@ -748,14 +752,11 @@ computeFootHeight( double& foot,int time ) { sotDEBUGIN(25); newtonEulerSINTERN(time); - //foot=m_HDR->footHeight(); - CjrlFoot *RightFoot = m_HDR->rightFoot(); - vector3d AnkleInLocalRefFrame,SoleCenterInLocalRefFrame; + CjrlFoot* RightFoot = m_HDR->rightFoot(); + vector3d AnkleInLocalRefFrame; RightFoot->getAnklePositionInLocalFrame(AnkleInLocalRefFrame); - RightFoot->getSoleCenterInLocalFrame(SoleCenterInLocalRefFrame); - foot = fabs(AnkleInLocalRefFrame[2]-SoleCenterInLocalRefFrame[2]); sotDEBUGOUT(25); - return foot; + return AnkleInLocalRefFrame[2]; } diff --git a/unitTesting/test_djj.cpp b/unitTesting/test_djj.cpp index c9b5f2d..9b4d24f 100644 --- a/unitTesting/test_djj.cpp +++ b/unitTesting/test_djj.cpp @@ -45,9 +45,9 @@ void DisplayDynamicRobotInformation(CjrlDynamicRobot *aDynamicRobot) for(int i=0;i<r;i++) { cout << aVec[i]->rankInConfiguration()<< endl; - } + } + - } void DisplayMatrix(MAL_MATRIX(,double) &aJ) @@ -69,15 +69,15 @@ void DisplayMatrix(MAL_MATRIX(,double) &aJ) /* --- DISPLAY MASS PROPERTIES OF A CHAIN --- */ void GoDownTree(const CjrlJoint * startJoint) { - cout << "Mass-inertie property of joint ranked :" + cout << "Mass-inertie property of joint ranked :" << startJoint->rankInConfiguration() << endl; - cout << "Mass of the body: " + cout << "Mass of the body: " << startJoint->linkedBody()->mass() << endl; - cout << "llimit: " + cout << "llimit: " << startJoint->lowerBound(0)*180/M_PI << " ulimit: " << startJoint->upperBound(0)*180/M_PI << endl; cout << startJoint->currentTransformation() << endl; - + if (startJoint->countChildJoints()!=0) { const CjrlJoint * childJoint = startJoint->childJoint(0); @@ -96,7 +96,7 @@ int main(int argc, char *argv[]) cerr << "./TestHumanoidDynamicRobot PATH_TO_VRML_FILE " << "VRML_FILE_NAME PATH_TO_SPECIFICITIES_XML" << endl; exit(0); - } + } string aPath=argv[1]; string aName=argv[2]; @@ -104,13 +104,13 @@ int main(int argc, char *argv[]) // DynamicMultiBody * aDMB // = new DynamicMultiBody(); // aDMB->parserVRML(aPath,aName,""); -// HumanoidDynamicMultiBody *aHDMB +// HumanoidDynamicMultiBody *aHDMB // = new HumanoidDynamicMultiBody(aDMB,aSpecificitiesFileName); /* ------------------------------------------------------------------------ */ dynamicsJRLJapan::ObjectFactory aRobotDynamicsObjectConstructor; CjrlHumanoidDynamicRobot * aHDR = aRobotDynamicsObjectConstructor.createHumanoidDynamicRobot(); - + // DynamicMultiBody * aDMB // = (DynamicMultiBody *) aHDMB->getDynamicMultiBody(); @@ -122,19 +122,19 @@ int main(int argc, char *argv[]) cout << "-> Finished the initialization"<< endl; /* ------------------------------------------------------------------------ */ - + // Display tree of the joints. - CjrlJoint* rootJoint = aHDR->rootJoint(); + CjrlJoint* rootJoint = aHDR->rootJoint(); RecursiveDisplayOfJoints(rootJoint); // Test the computation of the jacobian. - double dInitPos[40] = { + double dInitPos[40] = { 0.0, 0.0, -26.0, 50.0, -24.0, 0.0, 0.0, 0.0, -26.0, 50.0, -24.0, 0.0, // legs 0.0, 0.0, 0.0, 0.0, // chest and head 15.0, -10.0, 0.0, -30.0, 0.0, 0.0, 10.0, // right arm - 15.0, 10.0, 0.0, -30.0, 0.0, 0.0, 10.0, // left arm + 15.0, 10.0, 0.0, -30.0, 0.0, 0.0, 10.0, // left arm -20.0, 20.0, -20.0, 20.0, -20.0, // right hand -10.0, 10.0, -10.0, 10.0, -10.0 // left hand @@ -151,7 +151,7 @@ int main(int argc, char *argv[]) aHDR->currentConfiguration(aCurrentConf); /* Set current velocity to 0. */ - MAL_VECTOR_DIM(aCurrentVel,double,NbOfDofs); + MAL_VECTOR_DIM(aCurrentVel,double,NbOfDofs); for(int i=0;i<NbOfDofs;i++) aCurrentVel[i] = 0.0; aHDR->currentVelocity(aCurrentVel); @@ -163,7 +163,7 @@ int main(int argc, char *argv[]) aHDR->computeForwardKinematics(); ZMPval = aHDR->zeroMomentumPoint(); cout << "First value of ZMP : " << ZMPval <<endl; - cout << "Should be equal to the CoM (on x-y): " + cout << "Should be equal to the CoM (on x-y): " << aHDR->positionCenterOfMass() << endl; /* Get Rhand joint. */ @@ -177,19 +177,20 @@ int main(int argc, char *argv[]) aJoint->computeJacobianJointWrtConfig(); MAL_MATRIX(,double) aJ = aJoint->jacobianJointWrtConfig(); DisplayMatrix(aJ); - + /* Get Waist joint. */ cout << "****************************" << endl; rootJoint->computeJacobianJointWrtConfig(); - aJ = rootJoint->jacobianJointWrtConfig(); + aJ = rootJoint->jacobianJointWrtConfig(); cout << "Rank of Root: " << rootJoint->rankInConfiguration() << endl; aJoint = aHDR->waist(); /* Get CoM jacobian. */ cout << "****************************" << endl; - aHDR->computeJacobianCenterOfMass(); + matrixNxP jacobian; + aHDR->getJacobianCenterOfMass(*aHDR->rootJoint(), jacobian); cout << "Value of the CoM's Jacobian:" << endl - << aHDR->jacobianCenterOfMass() << endl; + << jacobian << endl; /* Display the mass property of the leg. */ cout << "****************************" << endl; @@ -223,5 +224,5 @@ int main(int argc, char *argv[]) // The End! delete aHDR; - + }