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++){
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)));
OpenHRP::CollisionSequence collisions
void clearExternalForces()
ForwardDynamicsPtr forwardDynamics
static const dReal SURFACE_MU
bool useInternalCollisionDetector_
virtual void calcNextState()
compute forward dynamics and update current state
static const dReal CONTACT_FDIR1_X
std::vector< LinkPair > LinkPairArray
int addBody(BodyPtr body)
add body to this world
void addBody(OpenHRP::BodyInfo_ptr body, const char *name)
add body to this world
const Vector3 & getGravityAcceleration()
get gravity acceleration
static const dReal SURFACE_SOFT_CFM
png_infop png_charpp name
static const dReal SURFACE_MOTION2
static const int COLLISION_MAX_POINT
static const dReal SURFACE_MU2
void addCollisionPair(OpenHRP::LinkPair &linkPair)
void initialize()
initialize this world. This must be called after all bodies are registered.
Vector3 w
angular velocity, omega
static const bool USE_QUICKSTEP
static const dReal CONTACT_SURFACE_LAYER
static const int QUICKSTEP_NUM_ITERATIONS
boost::shared_ptr< Body > BodyPtr
boost::shared_ptr< ODE_ForwardDynamics > ODE_ForwardDynamicsPtr
void getTransform(hrp::Vector3 &pos, hrp::Matrix33 &R)
void setSegmentAttitude(const Matrix33 &R)
ForwardDynamicsPtr forwardDynamics(int index)
get forward dynamics computation method for body
BodyPtr body(int index)
get body by index
void setGravityAcceleration(const dVector3 &gravity)
set gravity acceleration
void updateForceSensor(ODE_ForceSensor *sensor)
static const int SURFACE_MODE
static const dReal SURFACE_BOUNCE
def j(str, encoding="cp932")
static const dReal SURFACE_SOFT_ERP
static const dReal SURFACE_SLIP1
virtual void updateSensorsFinal()
static const dReal CONTACT_FDIR1_Z
virtual void initializeSensors()
static const dReal DEFAULT_GRAVITY_ACCELERATION
static const dReal SURFACE_SLIP2
static const dReal CONTACT_MAX_CORRECTING_VEL
static const dReal SURFACE_BOUNCE_VEL
virtual void calcNextState()
void ODE_collideCallback(void *data, dGeomID o1, dGeomID o2)
static const dReal SURFACE_MOTION1
bool ODE_loadBodyFromBodyInfo(BodyPtr body, ODE_World *world, OpenHRP::BodyInfo_ptr bodyInfo)
void getLinearVel(hrp::Vector3 &v)
static const dReal CONTACT_FDIR1_Y
ODE_ForwardDynamics(hrp::BodyPtr body)
dJointGroupID contactgroupId
const dReal * getAngularVel()
unsigned int numBodies()
get the number of bodies in this world
dJointGroupID getJointGroupID()
std::vector< BodyInfo > bodyInfoArray
virtual void initialize()
Vector3 c
center of mass (self local)