Bugs, or possibly my misunderstanding.

I’ve been putzing around with ode and panda, and I’ve noticed two things that look like bugs, although I’ve just started looking at this, so maybe I’m missing something. Both of these issues exist in both panda 1.7.0 and 1.6.2

  1. I’m pretty sure that OdeWorld.addBodyDampening() is supposed to acutally modify the dampening.

OdeWorld::add_body_dampening() doesn’t actually allow you to set the dampening. I assume that was it’s intention.

  1. in attach() from OdeJoint-extensions.py,


elif not body1 and body2:
    self.attachBody(body2, 1)

actually be:

elif not body1 and body2:
    self.attachBody(body2, 0)

I though only id 0 had a special meaning.

Neither of these bugs actually effects my programs, and I haven’t bothered to try and prove that they actually are bugs, but going through the code, they don’t make sense to me.

  1. All it does is add the body to the damping table with a dampen value of 0.0f. But I’m not sure if this method is supposed to be used by the developer - as the damping system is internally handled. This is just my understanding of the code though, I could be wrong.

  2. Hm… I’m a bit reluctant to ‘fix’ it if I’m not sure that this is actually wrong.

Here’s my issue. The autoCollide is not flexible enough for what I want to use it for. So I decided to use the lower level API and write a replacement in python (possibly to port C++ later, if the performance hit is too high). I realize that coppertop has already done this, but there’s nothing like reinventing the wheel to help with understanding it.

Unfortunately, not every useful function is exported. For instance OdeWorld::set_dampen_on_bodies() isn’t exported. I figured I could get around that by using the exported function OdeWorld.addBodyDampening(), but for some reason, that function takes a surface, which it uses for nothing, and simply adds the body to the dampening table with a value of 0 (which already happens in the OdeBody contructor). It really looks like it was supposed to take a dampen value and set the body’s dampen
to that. That would be something useful. The only caller is the OdeBody contructor, which looks like it is using it to
set the dampening value to zero.

The reason that fixing this is important is that the only way to to apply dampening to the angular and linear velocity of a body from python is by using the exported OdeWorld.ApplyDampening() which looks up the values from the dmapening table. However without OdeWorld::set_dampen_on_bodies exported and with OdeWorld.addBodyDampening() not actually able to set the dampening to anything other than 0, it’s impossible to apply dampening from python, unless you use autoCollilde().

Quite right. This one was me not reading through the code enough. I though that this code was attaching to the BodyID 1, but it’s not. It is setting which index (0 or 1) gets attached to the environment (which it correctly sets as BodyID 0).

Sorry. I really need to read the code more before I post. Looking at the auto_callback() code. I see it set the dampening, but… I don’t see anything ever call OdeWorld::apply_dampening(). So unless I’m again missing something, it looks like the dampening that gets set by auto_callback doesn’t ever get used for anything. In fact I can’t see that any of the dampening stuff from collisions actually gets used.

At any rate, it looks like for what I’m currently doing, which is trying to mimic autoCollide from python, I don’t need to worry about the dampening, because it doesn’t appear to effect anything.

But shouldn’t it?

I don’t know about damping, but you can easily use your own callbacks rather than the autoCollide system. Just use it like you would use nearCallbacks in PyODE.

Yes, that’s what I’m doing. And for some reason, I missed the OdeBody.setAngularVel() and OdeBody.setLinearVel(), which let
me set the dampening manually, without needing to call OdeWorld.applyDampening(), so I’m good on all counts. However, that still doesn’t explain why autoCollide() doesn’t seem to actually use the dampening for anything. Of course, since most of my problems thus far have been from opening my mouth before reading the code completely, I’m willing to believe that I’m probably just missing something.

I’m just hoping that doing all this in python won’t cause too much of a performance hit…