Get interaction point and interaction forces between 2 ODE objects

59 views
Skip to first unread message

bhanu kiran chaluvadi

unread,
Apr 25, 2017, 5:16:48 AM4/25/17
to ode-users
Hi, 

I am new to ODE.  I am using a package called Chai3D for my haptics project and it supports ODE and also it had few working example. But none of them had a sample code for getting interaction forces between two ODE objects.

It has all the properties like dworld, dspace, dBody, dGeom etc..

I have no clue on how to get interaction point, forces and normal at that location between two ODE objects.

After going through a little bit of documentation I tried...

                // ODEobject->m_ode_body  gives dBodyID
dReal Force = *dBodyGetForce(ODEobject->m_ode_body);
cout << Force << endl;

But output printed is always zero(constant single real value) although interaction is clearly taking place. And also I think that forces vector should be of 3 dimensions. 

Can someone help me to get to get interaction point, forces and normal at that location between two ODE objects?

Any help would be greatly appreciated.


Thanks

Bertrand Caré

unread,
Apr 25, 2017, 5:50:52 AM4/25/17
to ode-...@googlegroups.com
Hi,

A couple years ago I made a wrapper library for ODE that includes, among others, point-to-point interactions forces. You declare in your code the interaction force function, assign interaction points to objects, and the simulation engine automatically applies forces according to the interactions you defined.

If it may help you, you can check it here : https://bitbucket.org/bcare/cgmdode-hg/

If you want to check the doc first, you may get it here : https://bitbucket.org/bcare/cgmdode-hg/src/60ba2f3d7bef101220f0d2a7231763b43f2685db/doc/cgmdode_0.4_usermanual.pdf?at=stable



Bertrand Caré
------------------
PGP 0x649ADAA07B4D9EC8
https://bertrand.care

Ara s'envisquen lei lumieras
Sota lo cèu, aval a l'orisont
Plan plan viéu despareisser Iera,
Devini encà lo pòrt de Tolon

--
You received this message because you are subscribed to the Google Groups "ode-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ode-users+unsubscribe@googlegroups.com.
To post to this group, send email to ode-...@googlegroups.com.
Visit this group at https://groups.google.com/group/ode-users.
For more options, visit https://groups.google.com/d/optout.

bhanu kiran chaluvadi

unread,
Apr 25, 2017, 3:01:57 PM4/25/17
to ode-users
Hi, 

Thanks for your reply. I went through the documentation and it's interesting. But as I mentioned, i am using Chai3D, which is also kind of the wrapper. And the only thing I need fro this small project is 
1. Know whether contact has occurred or not and if so what is the contact forces between them
2. dConstactGeom - like contact position, normal vector etc...

Can you suggest an example code implementing the above information?

Thanks..
To unsubscribe from this group and stop receiving emails from it, send an email to ode-users+...@googlegroups.com.

Bill Sellers

unread,
Apr 26, 2017, 3:00:36 AM4/26/17
to ode-...@googlegroups.com
You get this information from the contacts you create during the NearCallback routine. It's in all the ODE examples but they don't do the extra steps needed to actually get the information out. There is always a bit where the contacts are created and attached like this:

dJointID c = dJointCreateContact(worldID, contactGroup, &contact;
dJointAttach(c, b1, b2);

And what you need to do is attach a joint feedback struct to each contact so that you can read off the location, torques and forces

dJointSetFeedback(c, &jointFeedback);

You have to be careful because I think the reported values are around the centre of mass of the body not around the contact location which may be what you want (although you should check that because I could be wrong here). It probably won't affect the forces anyway because I'd expect the torques generated by the contact to be zero.

If you are using a wrapper then it may be very tricky to get this information. Your wrapper may not expose the NearCallback function and if it doesn't then there isn't any other way of getting at the data. You also have to do quite a bit of memory management to make this work neatly since the number of contacts varies. I maintain a contact list and make use of the void data pointer you can pass to the NearContact but it is quite ugly.

If there is no contact then nothing is returned, and I don't think you can easily get penetration depth - just location.

Cheers
Bill

On 25/04/2017 20:01, bhanu kiran chaluvadi wrote:
> Hi,
>
> Thanks for your reply. I went through the documentation and it's interesting. But as I mentioned, i am using Chai3D, which is also kind of the wrapper. And the only thing I need fro this small project is
> 1. Know whether contact has occurred or not and if so what is the contact forces between them
> 2. dConstactGeom - like contact position, normal vector etc...
>
> Can you suggest an example code implementing the above information?
>
> Thanks..
>
>
> On Tuesday, 25 April 2017 03:50:52 UTC-6, Bertrand Caré wrote:
>
> Hi,
>
> A couple years ago I made a wrapper library for ODE that includes, among others, point-to-point interactions forces. You declare in your code the interaction force function, assign interaction points to objects, and the simulation engine automatically applies forces according to the interactions you defined.
>
> If it may help you, you can check it here : https://bitbucket.org/bcare/cgmdode-hg/ <https://bitbucket.org/bcare/cgmdode-hg/>
>
> If you want to check the doc first, you may get it here : https://bitbucket.org/bcare/cgmdode-hg/src/60ba2f3d7bef101220f0d2a7231763b43f2685db/doc/cgmdode_0.4_usermanual.pdf?at=stable <https://bitbucket.org/bcare/cgmdode-hg/src/60ba2f3d7bef101220f0d2a7231763b43f2685db/doc/cgmdode_0.4_usermanual.pdf?at=stable>
>
>
>
> Bertrand Caré
> ------------------
> PGP 0x649ADAA07B4D9EC8
> https://bertrand.care
>
> Ara s'envisquen lei lumieras
> Sota lo cèu, aval a l'orisont
> Plan plan viéu despareisser Iera,
> Devini encà lo pòrt de Tolon
>
> 2017-04-25 4:38 GMT+02:00 bhanu kiran chaluvadi <nthdimensi...@gmail.com <javascript:>>:
>
> Hi,
>
> I am new to ODE. I am using a package called Chai3D for my haptics project and it supports ODE and also it had few working example. But none of them had a sample code for getting interaction forces between two ODE objects.
>
> It has all the properties like dworld, dspace, dBody, dGeom etc..
>
> I have no clue on how to get interaction point, forces and normal at that location between two ODE objects.
>
> After going through a little bit of documentation I tried...
>
> // ODEobject->m_ode_body gives dBodyID
> dReal Force = *dBodyGetForce(ODEobject->m_ode_body);
> cout << Force << endl;
>
> But output printed is always zero(constant single real value) although interaction is clearly taking place. And also I think that forces vector should be of 3 dimensions.
>
> Can someone help me to get to get interaction point, forces and normal at that location between two ODE objects?
>
> Any help would be greatly appreciated.
>
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups "ode-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to ode-users+...@googlegroups.com <javascript:>.
> To post to this group, send email to ode-...@googlegroups.com <javascript:>.
> Visit this group at https://groups.google.com/group/ode-users <https://groups.google.com/group/ode-users>.
> For more options, visit https://groups.google.com/d/optout <https://groups.google.com/d/optout>.
>
>
> --
> You received this message because you are subscribed to the Google Groups "ode-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to ode-users+...@googlegroups.com <mailto:ode-users+...@googlegroups.com>.
> To post to this group, send email to ode-...@googlegroups.com <mailto:ode-...@googlegroups.com>.

Rich Bayless

unread,
Apr 26, 2017, 12:10:16 PM4/26/17
to ode-users
Hello,

Take a look at these demos:

ode\demo\demo_boxstack.cpp
ode\demo\demo_feedback.cpp
ode\demo\demo_transmission.cpp

These examples use the dJointSetFeedback function.

Rich.
Reply all
Reply to author
Forward
0 new messages