Ode: woodrod breaking

Hi,

is it possible to have some kind of woodrod made up of two ode-cylinders which are connected by an anchor. The anchor shall be fixed and act like a hard clip. So when you press one of the cylinders the anchor shall bend a bit and when you don’t press anymore, it shall go back to basic position. But when the pressure is to strong, the anchor shall be removed ( The rod breaks ).

Is that possible hypothetically?

Thanks, blenderkid

In principal you could do this via an OdeUniversalJoint - you give it a target angle equivalent to straight and a maximum force (i.e. set the valid range to have the same upper and lower bound.) - it should bend a little before giving up. The problem is it won’t fully snap - you need to detect when it has been pushed too far and delete the joint. As ODE doesn’t provide the relevant information you could detect snapping by checking the angle - once it passes a certain point delete the joint. So yeah, its possible, I think, but I’ve never done anything that complicated with Pandas ODE interface, which is often broken, and you are going to have to do a fair bit of detective work to figure out the details. Start with the ODE manual! Oh, and just to make it extra fun, the bending will happen due to ODE’s soft constraints - you will need to weaken them for the joint otherwise you risk the system exploding!

Edit: That was just the first suitable joint that popped into my head - several others will also work I think, depending on requirements. Using a motor joint might be safer as it will handle the bending better.

I had a similar problem lately and couldn’t solve it with elegantly the built-in ODE. Note that ODE does support this in principle: the method joint.getFeedback()[1] returns the forces acting on it, so it’s easy to use it as a reset force or remove the joint if the forces get too large. However you have to use PyODE in order to do that, the panda3d wrappers don’t support it. I have posted this issue on the forum[2] to ask if someone knew a workaround, but it appears no-one does. Maybe it’s a problem with panda’s version of ODE (too old?). I’d guess it’d be relatively easy to fix for someone intimate with the ODE-wrappers.

All of this is made worse with the fact that panda’s ODE api is sadly undocumented :frowning: I have the feeling that there’s a lot possible with these methods called setParamCFM and the like … I’m just not sure exactly what …

Let us know if you find a good solution to your problem!

  1. http://pyode.sourceforge.net/api-1.2.0/public/ode.Joint-class.html#getFeedback
  2. https://discourse.panda3d.org/viewtopic.php?t=7294

Pandas ODE wrappers are, I’m afraid to say, a bit of a joke - they were evidently written at speed for a specific purpose, and then never maintained/expanded beyond that original mess. But they have many flaws, of which the one you mention is relatively minor, and wouldn’t take long to fix - other flaws can be real show stoppers. However, for the documentation issue nearly all of the Panda ODE functions closely match the actual ODE once - so just read ODE’s manual and you can work out what they all do. Well, mostly, some of them have been screwed with in creative ways.

Just checked in a fix to CVS that exposes setFeedback and getFeedback. It should work just like in PyODE now - you call setFeedback(True) to allocate a feedback buffer and then you can call getFeedback whenever you want, which returns an OdeJointFeedback object, on which you can call getForce# and getTorque#.

Keep in mind that after calling setFeedback(True), getFeedback might be filled in with random values. Also, setFeedback(False) will deallocate the OdeJointFeedback object and that will probably corrupt any existing OdeJointFeedback objects of that same joint.

Thanks a lot! Can’t wait for the next release …