Force sensor and OdejavajME Physics sources

Hello

Foreword:

I'm looking for a way to create a force sensor. Somewhere i found, that Ode creates special "Contact joints" when 2 objects collides. This joints destroyes automatically next tact (true?). And also i found , that joint classes in odejava allows to get JointFeedback, which is what i need.

I have started to look at [jME Physics 2] and [Odejava] sources to find a way to put this JointFeedback in each PendingInfo, that is used in ContactCallback.

Obviously, the way is to catch a moment when Ode creates a contact joint, then extract the feedback from it.

So I ve looked into OdePhysicSpace class.

What i found :

in computeTimeStep() function

1: collide collision groups (true?) , also makes dContact  objects with native Ode function in collide function of "collision" object of JavaCollision class. // brrrr

2: iterateContacts( true ) launches callbacks (true?) // iterateContacts() function

3: then , joints creates. // applyContact() frunction



the "PendingContact contact" object, as i understand ,  provides current contact info to callback function(true?). It uses "odeContact" for this purposes.

SWIGTYPE_p_dJointID Ode.dJointCreateContact(world.getId(), javaCollision.getContactGroupId(), contact); creates the contact joint.

If i could to create a SWIGTYPE_p_dJointID on each iteration in iterateContacts() manually , then add JointFeedback from this joint info to PendingContactInfo, callback function could catch and extract this feedback info.



But as you see , this function takes "contact" field that is dContact type. And i don't know where i can get this object for current state of "odeContact". So , how can i get dContact thing of current contact that is currently calculating in iterate cycle?

Any other ways to create a force sensor?


sry 4 my eng=(


Your description of the process sounds right (iirc, I didn't double check it).



But the contact joints are created by the native method createContactJoints. Multiple at one. So it cannot return a joint id. You only have the group id - which cannot really be used on the java side currently. This means you need to change odejava on the native side to get feedback from contact joints. But, do you really need that?



What should your force sensor actually detect? Can you probably model it with another joint? Or can you compute it from the existing contact info?

But the contact joints are created by the native method createContactJoints. Multiple at one. So it cannot return a joint id.


So , i want to create joints manually . That means that i will remove
"collision.applyContacts();" call in "computeTimeStep()" and replace it work by mannually creating joints with Ode.dJointCreateContact in iterateContacts(); call.
Actually i have found this http://www.javagaming.org/index.php/topic,8258.0.html post at javagaming forum. He describes the idea of how he made sensor. It seems that its works.

What should your force sensor actually detect? Can you probably model it with another joint? Or can you compute it from the existing contact info?


Just a contact force sensor on a robot leg.  I must know the force of collision leg with floor.