odespace.h   odespace.h 
skipping to change at line 186 skipping to change at line 186
vjoints.resize(0); vjoints.resize(0);
_geometrycallback.reset(); _geometrycallback.reset();
_staticcallback.reset(); _staticcallback.reset();
} }
KinBodyPtr pbody; ///< body associated with this structure KinBodyPtr pbody; ///< body associated with this structure
int nLastStamp; int nLastStamp;
vector<boost::shared_ptr<LINK> > vlinks; ///< if body is di sabled, then geom is static (it can't be connected to a joint!) vector<boost::shared_ptr<LINK> > vlinks; ///< if body is di sabled, then geom is static (it can't be connected to a joint!)
vector<int> _vdofbranches;
///< the pointer to this Link is the userdata ///< the pointer to this Link is the userdata
vector<dJointID> vjoints; vector<dJointID> vjoints;
vector<dJointFeedback> vjointfeedback; vector<dJointFeedback> vjointfeedback;
boost::shared_ptr<void> _geometrycallback, _staticcallback; boost::shared_ptr<void> _geometrycallback, _staticcallback;
boost::weak_ptr<ODESpace> _odespace; boost::weak_ptr<ODESpace> _odespace;
dSpaceID space; ///< space that contani s all the collision objects of this chain dSpaceID space; ///< space that contani s all the collision objects of this chain
dJointGroupID jointgroup; dJointGroupID jointgroup;
private: private:
skipping to change at line 321 skipping to change at line 323
dGeomSetQuaternion(geom,t.rot); dGeomSetQuaternion(geom,t.rot);
dGeomSetPosition(geom,t.trans.x, t.trans.y, t.trans.z); dGeomSetPosition(geom,t.trans.x, t.trans.y, t.trans.z);
// finally set the geom to the ode body // finally set the geom to the ode body
dGeomSetBody(geomtrans, link->body); dGeomSetBody(geomtrans, link->body);
link->geom = geomtrans; link->geom = geomtrans;
} }
if( !(*itlink)->IsStatic() && _bUsingPhysics ) { if( !(*itlink)->IsStatic() && _bUsingPhysics ) {
// set the mass // set the mass
RaveTransformMatrix<dReal> I = (*itlink)->GetLocalInertia() ;
dMass mass; dMass mass;
dMassSetZero(&mass); dMassSetZero(&mass);
mass.mass = (*itlink)->GetMass(); mass.mass = (*itlink)->GetMass();
mass.I[0] = I.m[0]; mass.I[1] = I.m[1]; mass.I[2] = I.m[2];
mass.I[4] = I.m[4]; mass.I[5] = I.m[5]; mass.I[6] = I.m[6];
mass.I[8] = I.m[8]; mass.I[9] = I.m[9]; mass.I[10] = I.m[10
];
// ignore center of mass for now (ode doesn't like it when
it is non-zero)
//mass.c = I.trans;
if( mass.mass <= 0 ) { if( mass.mass <= 0 ) {
RAVELOG_WARN(str(boost::format("body %s:%s mass is %f. filling dummy values")%pbody->GetName()%(*itlink)->GetName()%mass.mass)); RAVELOG_WARN(str(boost::format("body %s:%s mass is %f. filling dummy values")%pbody->GetName()%(*itlink)->GetName()%mass.mass));
mass.mass = 1e-7; mass.mass = 1e-7;
mass.I[0] = 1; mass.I[1] = 0; mass.I[2] = 0; mass.I[0] = 1; mass.I[1] = 0; mass.I[2] = 0;
mass.I[4] = 0; mass.I[5] = 1; mass.I[6] = 0; mass.I[4] = 0; mass.I[5] = 1; mass.I[6] = 0;
mass.I[8] = 0; mass.I[9] = 0; mass.I[10] = 1; mass.I[8] = 0; mass.I[9] = 0; mass.I[10] = 1;
} }
else {
if( (*itlink)->GetPrincipalMomentsOfInertia().lengthsqr
3() > 0 ) {
RaveTransformMatrix<dReal> I = (*itlink)->GetLocalI
nertia();
mass.I[0] = I.m[0]; mass.I[1] = I.m[1]; mass.I[2] =
I.m[2];
mass.I[4] = I.m[4]; mass.I[5] = I.m[5]; mass.I[6] =
I.m[6];
mass.I[8] = I.m[8]; mass.I[9] = I.m[9]; mass.I[10]
= I.m[10];
}
else {
mass.I[0] = 1; mass.I[1] = 0; mass.I[2] = 0;
mass.I[4] = 0; mass.I[5] = 1; mass.I[6] = 0;
mass.I[8] = 0; mass.I[9] = 0; mass.I[10] = 1;
}
}
// ignore center of mass for now (ode doesn't like it when
it is non-zero)
//mass.c = ?;
dBodySetMass(link->body, &mass); dBodySetMass(link->body, &mass);
} }
link->plink = *itlink; link->plink = *itlink;
// set the transformation // set the transformation
RaveTransform<dReal> t = (*itlink)->GetTransform(); RaveTransform<dReal> t = (*itlink)->GetTransform();
dBodySetPosition(link->body,t.trans.x, t.trans.y, t.trans.z); dBodySetPosition(link->body,t.trans.x, t.trans.y, t.trans.z);
BOOST_ASSERT( RaveFabs(t.rot.lengthsqr4()-1) < 0.0001f ); BOOST_ASSERT( RaveFabs(t.rot.lengthsqr4()-1) < 0.0001f );
dBodySetQuaternion(link->body,t.rot); dBodySetQuaternion(link->body,t.rot);
dBodySetData(link->body, &link->plink); // so that the link can be retreived from the body dBodySetData(link->body, &link->plink); // so that the link can be retreived from the body
skipping to change at line 561 skipping to change at line 573
_synccallback = synccallback; _synccallback = synccallback;
} }
typedef void (*JointSetFn)(dJointID, int param, dReal val); typedef void (*JointSetFn)(dJointID, int param, dReal val);
JointSetFn _jointset[12]; JointSetFn _jointset[12];
private: private:
void Synchronize(KinBodyInfoPtr pinfo) void Synchronize(KinBodyInfoPtr pinfo)
{ {
vector<Transform> vtrans; vector<Transform> vtrans;
pinfo->pbody->GetLinkTransformations(vtrans); pinfo->pbody->GetLinkTransformations(vtrans, pinfo->_vdofbranches);
pinfo->nLastStamp = pinfo->pbody->GetUpdateStamp(); pinfo->nLastStamp = pinfo->pbody->GetUpdateStamp();
BOOST_ASSERT( vtrans.size() == pinfo->vlinks.size() ); BOOST_ASSERT( vtrans.size() == pinfo->vlinks.size() );
for(size_t i = 0; i < vtrans.size(); ++i) { for(size_t i = 0; i < vtrans.size(); ++i) {
RaveTransform<dReal> t = vtrans[i]; RaveTransform<dReal> t = vtrans[i];
BOOST_ASSERT( RaveFabs(t.rot.lengthsqr4()-1) < 0.0001f ); BOOST_ASSERT( RaveFabs(t.rot.lengthsqr4()-1) < 0.0001f );
dBodySetQuaternion(pinfo->vlinks[i]->body, t.rot); dBodySetQuaternion(pinfo->vlinks[i]->body, t.rot);
dBodySetPosition(pinfo->vlinks[i]->body, t.trans.x, t.trans.y, t.trans.z); dBodySetPosition(pinfo->vlinks[i]->body, t.trans.x, t.trans.y, t.trans.z);
} }
if( !!_synccallback ) { if( !!_synccallback ) {
_synccallback(pinfo); _synccallback(pinfo);
 End of changes. 5 change blocks. 
9 lines changed or deleted 25 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/