|
From: Markus R. <rol...@un...> - 2008-04-11 17:06:13
|
Hi,
Feng Xue schrieb:
> I just finished the generic code for the disable of inner collision
> of nao robot. Hope it will work. Please have a check. Welcome more
> criticism.
This code looks more generic and should work, but...
Could you please the describe the problem you are trying to solve? From
reading your source it seems that the Nao model has some stability
problems because some bodies within it's ODE space are constantly colliding?
Why didn't we have this problem the the soccerbot model? What is
different with the nao model?
I think that the problem should be corrected in the structure of the
robot model and not within the space class.
Apart from that I have some comments concerning the source code, as this
is a 'hot path' in the sense that it is performance critical as it is
called very often.
The whole test is rather expensive, as we have to walk the parent chain
of the bodies to find the Space instances for each(!) collision callback.
[lib/oxygen/physicsserver/space.cpp]
> // colliding two non-space geoms; reject collisions
> 90 // between bodies that are connected with joints
> 91 const dBodyID b1 = dGeomGetBody(obj1);
> 92 const dBodyID b2 = dGeomGetBody(obj2);
> 93
> 94 if ((b1) && (b2) && (dAreConnectedExcluding(b1,b2,dJointTypeContact)))
> 95 {
> 96 return;
> 97 }
> 98
> 99 //If obj1 and obj2 are in a space that disabled inner collision, no collide
> 100 boost::shared_ptr<Collider> c1 = Collider::GetCollider(obj1);
> 101 boost::shared_ptr<Collider> c2 = Collider::GetCollider(obj2);
> 102 if (b1 && b2 && c1.get() && c2.get())
> 103 {
please remove the additional test of (b1 && b2) and move it together
with the GetCollider calls into the scope below line 95 (there b1 && b2
is already true).
> 104 shared_ptr<Space> s1 = c1->GetSpace();
> 105 shared_ptr<Space> s2 = c2->GetSpace();
> 106
> 107 if (s1.get() && s2.get() && (s1.get() == s2.get()))
> 108 {
> 109 if (s1->IsDisableInnerCollision() && s2->IsDisableInnerCollision())
> 110 {
here (s1 == s2) is true therefore the second test of
IsDisableInnerCollision is not needed. Further you only need to call
c2->GetSpace() if s1 is !=0.
> 111 return;
> 112 }
> 113 }
> 114 }
cheers,
Markus
|