47 dWorldSetGravity(
worldId, gravity[0], gravity[1], gravity[2]);
52 dWorldGetGravity(
worldId, gravity);
65 const char* bodyName[2];
66 bodyName[0] = linkPair.charName1;
67 bodyName[1] = linkPair.charName2;
69 const char* linkName[2];
70 linkName[0] = linkPair.linkName1;
71 linkName[1] = linkPair.linkName2;
75 std::cout <<
"ODE_World::addCollisionPair : Body ";
76 std::cout << bodyName[0] <<
" is not found." << std::endl;
81 std::cout <<
"ODE_World::addCollisionPair : Body ";
82 std::cout << bodyName[1] <<
" is not found." << std::endl;
87 std::cout <<
"ODE_World::addCollisionPair : Link ";
88 std::cout << linkName[0] <<
" is not found." << std::endl;
93 std::cout <<
"ODE_World::addCollisionPair : Link ";
94 std::cout << linkName[1] <<
" is not found." << std::endl;
108 for(
int i=0;
i<
n;
i++)
113 for(
int i=0;
i<corbaCollisionSequence.length();
i++){
114 OpenHRP::Collision& _collision = corbaCollisionSequence[
i];
115 std::string charName1 = (std::string)_collision.pair.charName1;
116 std::string linkName1 = (std::string)_collision.pair.linkName1;
118 std::string charName2 = (std::string)_collision.pair.charName2;
119 std::string linkName2 = (std::string)_collision.pair.linkName2;
122 OpenHRP::CollisionPointSequence& points = _collision.points;
123 int n = points.length();
124 for(
int j=0; j<
n; j++){
126 contact.geom.pos[0] = points[j].position[0];
127 contact.geom.pos[1] = points[j].position[1];
128 contact.geom.pos[2] = points[j].position[2];
129 contact.geom.normal[0] = -points[j].normal[0];
130 contact.geom.normal[1] = -points[j].normal[1];
131 contact.geom.normal[2] = -points[j].normal[2];
132 contact.geom.depth = points[j].idepth;
176 for(
int j=0; j<
b->numLinks(); j++){
187 info.forwardDynamics->initialize();
209 OpenHRP::CollisionSequence& collisions = world->
collisions;
212 int collisionIndex = -1;
213 dBodyID body1 = dGeomGetBody(o1);
214 dBodyID body2 = dGeomGetBody(o2);
216 for(
int i=0;
i<linkPairs.size();
i++){
217 if( (linkPairs[
i].bodyId1 == body1 && linkPairs[
i].bodyId2 == body2) ||
218 (linkPairs[
i].bodyId1 == body2 && linkPairs[
i].bodyId2 == body1) ){
223 if(collisionIndex == -1)
227 collisions[collisionIndex].points.length(
n);
228 for(
int i=0;
i<
n;
i++){
229 collisions[collisionIndex].points[
i].position[0] = contact[
i].geom.pos[0];
230 collisions[collisionIndex].points[
i].position[1] = contact[
i].geom.pos[1];
231 collisions[collisionIndex].points[
i].position[2] = contact[
i].geom.pos[2];
232 collisions[collisionIndex].points[
i].normal[0] = contact[
i].geom.normal[0];
233 collisions[collisionIndex].points[
i].normal[1] = contact[
i].geom.normal[1];
234 collisions[collisionIndex].points[
i].normal[2] = contact[
i].geom.normal[2];
235 collisions[collisionIndex].points[
i].idepth = contact[
i].geom.depth;
253 dJointAttach(
c, dGeomGetBody(contact[
i].geom.g1), dGeomGetBody(contact[
i].geom.g2));
259 ForwardDynamics(body)
271 #define M_2PI 6.28318530717958647692
274 for(
int i=0;
i<
body->numLinks();
i++){
277 link->
w << _w[0], _w[1], _w[2];
294 link->
q = (k+1) *
M_2PI + q;
299 link->
q = (k-1) *
M_2PI + q;
306 for(
int i=0;
i <
n; ++
i){
313 dJointFeedback* fb = dJointGetFeedback(link->
odeJointId);
320 hrp::Vector3 ts(sensorR.transpose() * (tau - sensorPos.cross(
f)));