Contact forces generated during multiple contacts

323 views
Skip to first unread message

Elvina Motard

unread,
Feb 27, 2009, 7:09:37 AM2/27/09
to ode-...@googlegroups.com
Dear all,

I am using ODE in an haptic system, so in a master-slave mode, where a
robotic arm (slave) is simulated in ODE.
Everytime I have a contact, I need to compute the torque caused by the
contact force in each joint of my slave. So for each contact detected
between the robot and the environment, I put a joint feedback on the
contact joint and then using the position of the contact, and the
contact force I compute the resulting torque in each of the joints.
I have a problem when I have multiple contacts; normally the forces
should be distributed, but it sounds to me that the total force is much
bigger than with only one contact. I have seen this problem in several
situations:
- when I have a contact on one joint and I move a bit the arm so that I
have another contact (for example I have a first contact on the wrist
and I move the end effector so that it also touches the obstacle)
- when I have a contact between a mesh and another object; this is the
worst case since lots of contact points are generated, and it greatly
increase the "total" force applied on the robotic arm.

Does anyone have an explication about this, or already faced (and
solved) this problem ?

Thanks for your help,
Elvina

Jon Watte

unread,
Feb 27, 2009, 1:11:20 PM2/27/09
to ode-...@googlegroups.com
Elvina Motard wrote:
> Everytime I have a contact, I need to compute the torque caused by the
> contact force in each joint of my slave. So for each contact detected
> between the robot and the environment, I put a joint feedback on the
> contact joint and then using the position of the contact, and the
> contact force I compute the resulting torque in each of the joints.
>

I have found that the best way to calculate force and torque is to
simply measure the angular and linear velocity at each step, and divide
the difference between two steps by step size. It always gives you the
"actual" force/torque applied by the system, and needs no internal
features like the feedback structure. The problem with trying to measure
each contact separately is that the different contacts may very well
counter-act each other, and the solver will mix the constraints of the
joints to some extent, as well as cancel out opposing forces/torques.

Sincerely,

jw

christopher

unread,
Feb 28, 2009, 9:38:10 PM2/28/09
to ode-users
> I have found that the best way to calculate force and torque is to
> simply measure the angular and linear velocity at each step, and divide
> the difference between two steps by step size.

Hi

what does this method mean in physics? Trying to calculate the
acceleration?
And then multiply the body's mass to get the actual force or torque?
But in some times, the object is jointed by many components. The whole
mass and inertia
are hard to get. So what can we do to get the contact force in ODE
when the object is very complicated.

Sincerely

pxw

Seng Fu Yee

unread,
Feb 28, 2009, 9:59:23 PM2/28/09
to ode-...@googlegroups.com
Hi,
 
I am a final year student working on a haptics FYP project. I am currently using Openhaptics and Chai3D, esp chai3D has examples with ODE built into it. On the other hand, I am still quite new to ODE. I am still figuring out what are the possibilities I can do with it?
 
May I know what haptics software you are using that integrates with ODE?
And, what do u plan to achieve?
 
thanks  

Daniel K. O.

unread,
Feb 28, 2009, 10:02:50 PM2/28/09
to ode-...@googlegroups.com
christopher escreveu:

>> I have found that the best way to calculate force and torque is to
>> simply measure the angular and linear velocity at each step, and divide
>> the difference between two steps by step size.
>
> what does this method mean in physics?

It's impulse. See the last equation on http://en.wikipedia.org/wiki/Impulse

Depending on your needs you can just ignore the mass term.

--
Daniel K. O.
"The only way to succeed is to build success yourself"

Jon Watte

unread,
Feb 28, 2009, 10:28:09 PM2/28/09
to ode-...@googlegroups.com
christopher wrote:
>
> what does this method mean in physics? Trying to calculate the
> acceleration?
> And then multiply the body's mass to get the actual force or torque?
>

Yes.

> But in some times, the object is jointed by many components. The whole
> mass and inertia
> are hard to get. So what can we do to get the contact force in ODE
> when the object is very complicated.
>

You get less data from individual contact joints than from inferring
torque/force by calculating momentary acceleration. The reason is that
there may be multiple contact joints for a given body. Similarly, there
may be multiple bodies for an overall articulating armature. If you want
the values for the armature overall, you have to integrate over space
for the different bodies to get a proper "average." Starting with the
per-body values is still easier than trying to start per joint, though.

Sincerely,

jw

christopher

unread,
Mar 1, 2009, 12:19:41 AM3/1/09
to ode-users
Oh I can see that now

Thanks for your explain.

Elvina Motard

unread,
Mar 3, 2009, 3:18:06 AM3/3/09
to ode-...@googlegroups.com
Hello all,

Thank you for these replies. Actually, it is ok to use the impulse if
you want to take into account external forces of the system. It is not
the case in my problem, because contact forces are internal forces, e.g.
when an object is pushed into another, they collide and the system can
be at the equilibrium, thus not moving. Using the equilibrium formula
the resulting force/torque is null, but I want to get the resulting
force/torque from the contact points.

To Seng Fu, who asked me what else than ode I am using... I am only
using ode; everything else is built in. The haptic device is a 7-DOF
arm-exoskeleton and its controller which communicate with the simulation
is qnx-based. The simulation runs on linux and is synchronized by the
controller which makes the simulation "real-time". The simulator
simulates a 7-DOF slave arm controller joint by joint by the master
device. If you want more informations, I can send you some papers.

Best regards, and if anyone has an idea for my multicontacts problem,
it's welcome !

Elvina
--
Elvina Motard
Robotics Engineer

Space Applications Services
Leuvensesteenweg 325, B-1932 Zaventem, Belgium
Tel: +32 2 721 54 84 Fax: +32 2 721 54 44
URL: http://www.spaceapplications.com

Wei Lv

unread,
Feb 23, 2016, 6:22:01 AM2/23/16
to ode-users, elvina...@spaceapplications.com
Elvina Motard,

Hi, there. It has been 7 years since the last reply to this group. Have you ever solved this multi-contacts problem? If you have, could you give me any ideas?

Sincerely,
Wei

在 2009年3月3日星期二 UTC+8下午4:18:06,Elvina Motard写道:

Oleh Derevenko

unread,
Feb 23, 2016, 6:52:39 AM2/23/16
to ode-...@googlegroups.com

Hi Wei,

Alas, nobody is actively developing ODE and there is no roadmap for it. Now and then some people add whatever is necessary for themselves or bugs are fixed, if reported.

Most likely, nobody spend time on that.

 

Oleh Derevenko

-- Skype with underscore

--
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.
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.




This e-mail may contain privileged and confidential information. If you are not the intended recipient, be aware that any use, disclosure, copying or distribution of this e-mail or any attachments is prohibited. If you have received this e-mail in error, please notify us immediately by returning it to the sender and delete this copy from your system. Thank you.

Bill Sellers

unread,
Feb 23, 2016, 7:17:00 AM2/23/16
to ode-...@googlegroups.com
To be fair there are quite a lot of ODE users who do fix things. And mostly it does what it needs to do very well so there is not much to fix... In the end libraries become fairly mature and really don't change very much. That is actually a good thing!

However if I understand this question correctly, I think there is a straightforward answer. You can easily get contact forces out by attaching the necessary feedback structure to the contact joint. There is a supported interface for doing that. What you need to do is in your near callback function, after you create the contact(s) with dJointCreateContact, you need to set the joint feedback structure with dJointSetFeedback. That will contain all the force data you want. That's certainly how I get the contact forces out and it works with as many contacts as you need to create.

Cheers
Bill

On 23/02/2016 11:52, Oleh Derevenko wrote:
> Hi Wei,
>
> Alas, nobody is actively developing ODE and there is no roadmap for it. Now and then some people add whatever is necessary for themselves or bugs are fixed, if reported.
>
> Most likely, nobody spend time on that.
>
>
>
> Oleh Derevenko
>
> -- Skype with underscore
>
>
>
>
>
> *From:*ode-...@googlegroups.com [mailto:ode-...@googlegroups.com] *On Behalf Of *Wei Lv
> *Sent:* Tuesday, February 23, 2016 1:01 PM
> *To:* ode-users
> *Cc:* elvina...@spaceapplications.com
> *Subject:* Re: [ode-users] Re: Contact forces generated during multiple contacts
> 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>.
> Visit this group at https://groups.google.com/group/ode-users.
> For more options, visit https://groups.google.com/d/optout.
>
>
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> This e-mail may contain privileged and confidential information. If you are not the intended recipient, be aware that any use, disclosure, copying or distribution of this e-mail or any attachments is prohibited. If you have received this e-mail in error, please notify us immediately by returning it to the sender and delete this copy from your system. Thank you.
>
> --
> 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>.

Wei Lv

unread,
Feb 23, 2016, 10:00:07 AM2/23/16
to ode-users
Hi Oleh and Bill,
Thanks a lot for your fast reply, and I am so glad that I could still get replies from this old post!

And Bill, your answer is more specific. I tried like you said, but there are still some things that I am not clear. For example, after I call dJointSetFeedback, I immediately use the dJointFeedback structure to access its data, but the truth is, those data are all zeros. I guess I must have accessed those data at a wrong place or a wrong time.

So when and where should I inquire the dJointFeedback structure properly? Could you show me a simple but relatively complete procedure?

Thanks again!
Wei

Oleh Derevenko

unread,
Feb 23, 2016, 10:25:29 AM2/23/16
to ode-...@googlegroups.com

See

  \ode\demo\demo_boxstack.cpp(167):                    dJointSetFeedback(c,&feedbacks[fbnum++].fb);

  \ode\demo\demo_feedback.cpp(258):    dJointSetFeedback (hinges[i], jfeedbacks+i);

  \ode\demo\demo_transmission.cpp(171):    dJointSetFeedback(transmission, &feedback);

 

Oleh Derevenko

-- Skype with underscore

  

 

From: ode-...@googlegroups.com [mailto:ode-...@googlegroups.com] On Behalf Of Wei Lv
Sent: Tuesday, February 23, 2016 5:00 PM
To: ode-users
Subject: Re: [ode-users] Re: Contact forces generated during multiple contacts

 

Hi Oleh and Bill,

Thanks a lot for your fast reply, and I am so glad that I could still get replies from this old post!

 

And Bill, your answer is more specific. I tried like you said, but there are still some things that I am not clear. For example, after I call dJointSetFeedback, I immediately use the dJointFeedback structure to access its data, but the truth is, those data are all zeros. I guess I must have accessed those data at a wrong place or a wrong time.

 

So when and where should I inquire the dJointFeedback structure properly? Could you show me a simple but relatively complete procedure?

 

Thanks again!

Wei

Bill Sellers

unread,
Feb 23, 2016, 3:29:28 PM2/23/16
to ode-...@googlegroups.com
Dear Wei,

It should work but there is a fair bit of memory management. The contacts are created in the near callback and then deleted. You need to manage the scope of the joint feedback so that it still exists when the contacts get deleted. I do this using the geom and callback user data but you could do other things too. My near callback looks like this (I have a class called Simulation that holds the main simulation loop, and a class called Contact that contains a copy of the joint feedback data and is stored as a list in the Simulation object). I clear this list before each simulation step because they are only valid within each step.

void Simulation::NearCallback(void *data, dGeomID o1, dGeomID o2)
{
int i;
int numc;
Simulation *s = (Simulation *)data;

// exit without doing anything if the two bodies are connected by a joint
dBodyID b1 = dGeomGetBody(o1);
dBodyID b2 = dGeomGetBody(o2);
Contact *myContact;

if (s->m_AllowConnectedCollisions == false)
{
if (b1 && b2 && dAreConnectedExcluding(b1, b2, dJointTypeContact)) return;
}

dContact *contact = new dContact[s->m_MaxContacts]; // up to m_MaxContacts contacts per box-box

numc = dCollide(o1, o2, s->m_MaxContacts, &contact[0].geom, sizeof(dContact));
if (numc)
{
for (i = 0; i < numc; i++)
{
dJointID c = dJointCreateContact(s->m_WorldID, s->m_ContactGroup, contact + i);
dJointAttach(c, b1, b2);

myContact = new Contact();
dJointSetFeedback(c, myContact->GetJointFeedback());
myContact->SetJointID(c);
memcpy(myContact->GetContactPosition(), contact[i].geom.pos, sizeof(dVector3));
s->m_ContactList.push_back(myContact);
}
}
delete [] contact;
}

Cheers
Bill
>> *From:*ode-...@googlegroups.com <javascript:>
>> [mailto:ode-...@googlegroups.com <javascript:>] *On Behalf Of *Wei
>> Lv *Sent:* Tuesday, February 23, 2016 1:01 PM *To:* ode-users *Cc:*
>> elvina...@spaceapplications.com <javascript:> *Subject:* Re:
>> ode-users+...@googlegroups.com <javascript:>
>> <mailto:ode-users+...@googlegroups.com <javascript:>>. To post to
>> this group, send email to ode-...@googlegroups.com <javascript:>
>> <mailto: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>.
>>
>>
>>
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>
>>
>> This e-mail may contain privileged and confidential information. If
>> you are not the intended recipient, be aware that any use,
>> disclosure, copying or distribution of this e-mail or any
>> attachments is prohibited. If you have received this e-mail in
>> error, please notify us immediately by returning it to the sender
>> and delete this copy from your system. Thank you.
>>
>> -- 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:>
>> <mailto:ode-users+...@googlegroups.com <javascript:>>. To post to
>> this group, send email to ode-...@googlegroups.com <javascript:>
>> <mailto: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>.

Wei Lv

unread,
Feb 24, 2016, 8:54:29 PM2/24/16
to ode-users
Hi Oleh,

Thousands of thanks! I got much inspiration from those demos!

Wei

在 2016年2月23日星期二 UTC+8下午11:25:29,Oleh Derevenko写道:

Wei Lv

unread,
Feb 24, 2016, 9:07:21 PM2/24/16
to ode-users
Hi Bill,

Your reply is very clear and inspiring, the explanation of memory management has greatly helped me solve my problem. Thanks a lot!

By the way, now I can measure contact forces, however, what I got is signals and noises, which means the measured force is fluctuated drastically. But it's not a big problem, using a low-pass filter can make it much more steady. I just wonder, is that like what you got?

Wei


在 2016年2月24日星期三 UTC+8上午4:29:28,wisellers写道:

Wei Lv

unread,
Mar 2, 2016, 8:18:01 AM3/2/16
to ode-users
Hi everyone,

According to ODE manual, the function dCollide will either return the number of contacts, or 0 if there is not any. I set the max number of contacts to be 8, but I can only get one or eight contacts whenever it's called. And I am so sure about this fact, because I use the conditional breakpoint to confirm it in the vs2010. Only when the number of contacts equals to 1 or 8 can the breakpoint be hit.

Why can't I get other numbers of contacts? At least, I think it's reasonable to get 2 to 3 contacts when 2 bodies collide.

Any ideas?

Thanks in advance.

Wei Lv

在 2016年2月24日星期三 UTC+8上午4:29:28,wisellers写道:
Dear Wei,

Oleh Derevenko

unread,
Mar 2, 2016, 8:25:16 AM3/2/16
to ode-...@googlegroups.com

Hi,

 

Could you please clarify once again, what is the condition in that conditional breakpoint you use?

 

Oleh Derevenko

-- Skype with underscore

  

 

From: ode-...@googlegroups.com [mailto:ode-...@googlegroups.com] On Behalf Of Wei Lv
Sent: Wednesday, March 02, 2016 3:18 PM
To: ode-users
Subject: Re: [ode-users] Re: Contact forces generated during multiple contacts

 

Hi everyone,

 

According to ODE manual, the function dCollide will either return the number of contacts, or 0 if there is not any. I set the max number of contacts to be 8, but I can only get one or eight contacts whenever it's called. And I am so sure about this fact, because I use the conditional breakpoint to confirm it in the vs2010. Only when the number of contacts equals to 1 or 8 can the breakpoint be hit.

 

Why can't I get other numbers of contacts? At least, I think it's reasonable to get 2 to 3 contacts when 2 bodies collide.

 

Any ideas?

 

Thanks in advance.

 

Wei Lv

Wei Lv

unread,
Mar 2, 2016, 8:41:37 AM3/2/16
to ode-users
Sorry to confuse you...Please see following code:

int numContacts = dCollide(o1, o2, NUM_CONTACTS, contactGeoms, sizeof(dContactGeom)); // NUM_CONTACTS = 8
// some other code, and I attach the breakpoint at this line

The condition goes like: numContacts == 3, when I want to check if I can get 3 contacts, and of course it can go like  numContacts == 6 when I want to do 6.

Is it clear?

Wei Lv

在 2016年3月2日星期三 UTC+8下午9:25:16,Oleh Derevenko写道:

Oleh Derevenko

unread,
Mar 2, 2016, 8:55:56 AM3/2/16
to ode-...@googlegroups.com

The number of contacts depends on types of geometries that collide and the way they collide. If you only get 1 or the maximum it probably means that the geometries you are working with do generate contacts like that. Other geometries may generate different counts.

--

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.
To post to this group, send email to ode-...@googlegroups.com.

Wei Lv

unread,
Mar 2, 2016, 9:39:19 AM3/2/16
to ode-users
Thanks for your explanation!

However, if each time there is only one contacts, it may cause oscillation of bodies. I measure the contact force by attaching dJointFeedback structures, but the measured force keeps  fluctuating drastically. You can see this in the following figure:


The blue line is original data measured in program, while the red one is the 20-point moving average.

I assume if there could be more contacts, then there will be less oscillation, and thus more smooth lines. 

Could you please give some advice on this?

Wei Lv

在 2016年3月2日星期三 UTC+8下午9:55:56,Oleh Derevenko写道:

Oleh Derevenko

unread,
Mar 2, 2016, 9:50:24 AM3/2/16
to ode-...@googlegroups.com

Could you post some fragments of your program to show how exactly you work with geometries and contacts? What exact types of geometries you test for collisions?

 

Oleh Derevenko

-- Skype with underscore

  

 

From: ode-...@googlegroups.com [mailto:ode-...@googlegroups.com] On Behalf Of Wei Lv
Sent: Wednesday, March 02, 2016 4:39 PM
To: ode-users
Subject: Re: [ode-users] Re: Contact forces generated during multiple contacts

 

Thanks for your explanation!

 

However, if each time there is only one contacts, it may cause oscillation of bodies. I measure the contact force by attaching dJointFeedback structures, but the measured force keeps  fluctuating drastically. You can see this in the following figure:

Image removed by sender.

Wei Lv

unread,
Mar 2, 2016, 10:43:36 AM3/2/16
to ode-users
Actually I am not using ODE directly, but delta3d, an open source game and simulation engine. But ODE is one of delta3d's module, and I can have direct access to ODE APIs. 

Here is my nearCallback:
void CollisionPolicy::MyNearCallback(void* data, dGeomID o1, dGeomID o2)
{
if (data == 0 || o1 == 0 || o2 == 0)
{
return;
}

//ODESpaceWrap* spaceWrap = static_cast<ODESpaceWrap*>(data);
CollisionPolicy* colPol = static_cast<CollisionPolicy*>(data);

Transformable* c1 = static_cast<Transformable*>(dGeomGetData(o1));
Transformable* c2 = static_cast<Transformable*>(dGeomGetData(o2));

dContactGeom contactGeoms[NUM_CONTACTS];

int numContacts = dCollide(o1, o2, NUM_CONTACTS, contactGeoms, sizeof(dContactGeom));

if (numContacts > 0 && c1 != 0 && c2 != 0)
{
if (c1 != 0 || c2 != 0)
{
dContact contact;

for (int i = 0; i < numContacts; ++i)
{
contact.surface.mode       = dContactBounce;
contact.surface.mu         = (dReal)1000.0;
contact.surface.bounce     = (dReal)0.75;
contact.surface.bounce_vel = (dReal)0.001;

contact.geom = contactGeoms[i];

// Make sure to call these both, because in the case of
// Trigger, meaningful stuff happens even if the return
// is false.
bool contactResult1 = c1->FilterContact(&contact, c2);
bool contactResult2 = c2->FilterContact(&contact, c1);

if (contactResult1 && contactResult2)
{
// All this also should be in a virtual function.
Physical* p1 = dynamic_cast<Physical*>(c1);
Physical* p2 = dynamic_cast<Physical*>(c2);

if (p1 != 0 || p2 != 0)
{
/*dJointID joint = dJointCreateContact(spaceWrap->mWorldWrapper->GetWorldID(),
spaceWrap->mContactJointGroupID,
&contact);*/

dJointID joint = dJointCreateContact(colPol->_mScene->GetWorldID(),
colPol->_mScene->GetContactJointGroupID(),
&contact);

dJointAttach(joint,
p1 != 0 && p1->DynamicsEnabled() ? p1->GetBodyID() : 0,
p2 != 0 && p2->DynamicsEnabled() ? p2->GetBodyID() : 0);

// set feedback
for (unsigned int i=0; i<colPol->mSensorVector.size(); ++i)
{
std::string who = colPol->mSensorVector[i]->name;
if (p1->GetName() == who || p2->GetName() == who)
{
if (colPol->mSensorVector[i]->numFeedbacks < MAX_FEEDBACKNUM)
{
colPol->mSensorVector[i]->CFVector.push_back(new ContactFeedback());
colPol->mSensorVector[i]->CFVector[colPol->mSensorVector[i]->numFeedbacks]->first
= p1->GetName()==who;
dJointSetFeedback(joint,&(colPol->mSensorVector[i]->CFVector[colPol->mSensorVector[i]->numFeedbacks++]->joint_feedback));
}
else
colPol->mSensorVector[i]->numFeedbacks++;
}
}
}
}
}
}
}
}
CFVector is a collection of ContactFeedback, which consists of a dJointFeedback and some other information. Here in this callback are ContactFeedbacks created, and at some other place right before Simulation Step function, they will be cleared.

If you need any more information, please let me know. And thanks for your help.

Wei Lv

在 2016年3月2日星期三 UTC+8下午10:50:24,Oleh Derevenko写道:

Oleh Derevenko

unread,
Mar 2, 2016, 4:50:37 PM3/2/16
to ode-...@googlegroups.com

The code looks OK. So what types of geometries do you use? For example a sphere generates a single contact if collided with a plane or a box face, since it is enough to apply force just along radius to move the sphere out of the penetration. Similarly, other geometries may generate various numbers of contacts depending on which of their features (vertices, edges, faces) do actually penetrate each other. You could just be interacting with specific geometries in a specific way, so that you only get 1 or many each time, could not you?

 

Oleh Derevenko

-- Skype with underscore

  

 

From: ode-...@googlegroups.com [mailto:ode-...@googlegroups.com] On Behalf Of Wei Lv
Sent: Wednesday, March 02, 2016 5:44 PM
To: ode-users
Subject: Re: [ode-users] Re: Contact forces generated during multiple contacts

 

Actually I am not using ODE directly, but delta3d, an open source game and simulation engine. But ODE is one of delta3d's module, and I can have direct access to ODE APIs. 

 

Here is my nearCallback:


Wei Lv

unread,
Mar 2, 2016, 8:02:30 PM3/2/16
to ode-users
Well, for now the geometries I use are spheres and boxes, so there couldn't be more than 1 contact...I'll keep this in my mind...

If so, the fluctuating forces may not be caused by insufficient number of contacts, then what reason could it be? When you measure the contact forces, does it also keep fluctuating?

Wei Lv

在 2016年3月3日星期四 UTC+8上午5:50:37,Oleh Derevenko写道:

Bill Sellers

unread,
Mar 3, 2016, 5:58:26 AM3/3/16
to ode-...@googlegroups.com
Dear Wei Lv,

Unfortunately it isn't a very accurate contact model and so the force does fluctuate. What I tend to do is low pass filter the contact force drastically to get some sort of useful average value. One reason the force fluctuates so much is that using the suggested ERP and CFM values produces a very stiff model. You can change these values and you will get a less spiky response but often at the cost of stability. You can also change them just for the contacts which may help too. I'm not aware of any physics engine that does a particularly good job with contacts. There used to be one called MOBY that at least gave you a choice of different contact models but I don't think it has been maintained for a while and I've never actually tried it.

Cheers
Bill

On 02/03/2016 14:39, Wei Lv wrote:
> Thanks for your explanation!
>
> However, if each time there is only one contacts, it may cause oscillation of bodies. I measure the contact force by attaching dJointFeedback structures, but the measured force keeps fluctuating drastically. You can see this in the following figure:
>
> <https://lh3.googleusercontent.com/-NjCNbMHuXf8/Vtb5zyEgoFI/AAAAAAAAAAo/ll_9uOxxGIc/s1600/fig1.png>
>
>
> The blue line is original data measured in program, while the red one is the 20-point moving average.
>
> I assume if there could be more contacts, then there will be less oscillation, and thus more smooth lines.
>
> Could you please give some advice on this?
>
> Wei Lv
>
> 在 2016年3月2日星期三 UTC+8下午9:55:56,Oleh Derevenko写道:
>
> The number of contacts depends on types of geometries that collide and the way they collide. If you only get 1 or the maximum it probably means that the geometries you are working with do generate contacts like that. Other geometries may generate different counts.
>
>
>
> Oleh Derevenko
>
> -- Skype with underscore
>
>
>
>
>
> *From:*ode-...@googlegroups.com <javascript:> [mailto:ode-...@googlegroups.com <javascript:>] *On Behalf Of *Wei Lv
> *Sent:* Wednesday, March 02, 2016 3:42 PM
> *To:* ode-users
> *Subject:* Re: [ode-users] Re: Contact forces generated during multiple contacts
>
>
>
> Sorry to confuse you...Please see following code:
>
>
>
> int numContacts = dCollide(o1, o2, NUM_CONTACTS, contactGeoms, sizeof(dContactGeom)); // NUM_CONTACTS = 8
>
> // some other code, and I attach the breakpoint at this line
>
>
>
> The condition goes like: numContacts == 3, when I want to check if I can get 3 contacts, and of course it can go like numContacts == 6 when I want to do 6.
>
>
>
> Is it clear?
>
>
>
> Wei Lv
>
> 在 2016年3月2日星期三 UTC+8下午9:25:16,Oleh Derevenko写道:
>
> Hi,
>
>
>
> Could you please clarify once again, what is the condition in that conditional breakpoint you use?
>
>
>
> Oleh Derevenko
>
> -- Skype with underscore
>
>
>
>
>
> *From:*ode-...@googlegroups.com [mailto:ode-...@googlegroups.com] *On Behalf Of *Wei Lv
> *Sent:* Wednesday, March 02, 2016 3:18 PM
> *To:* ode-users
> *Subject:* Re: [ode-users] Re: Contact forces generated during multiple contacts
>
>
>
> Hi everyone,
>
>
>
> According to ODE manual, the function dCollide will either return the number of contacts, or 0 if there is not any. I set the max number of contacts to be 8, but I can only get one or eight contacts whenever it's called. And I am so sure about this fact, because I use the conditional breakpoint to confirm it in the vs2010. Only when the number of contacts equals to 1 or 8 can the breakpoint be hit.
>
>
>
> Why can't I get other numbers of contacts? At least, I think it's reasonable to get 2 to 3 contacts when 2 bodies collide.
>
>
>
> Any ideas?
>
>
>
> Thanks in advance.
>
>
>
> Wei Lv
>
>
>
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>
> This e-mail may contain privileged and confidential information. If you are not the intended recipient, be aware that any use, disclosure, copying or distribution of this e-mail or any attachments is prohibited. If you have received this e-mail in error, please notify us immediately by returning it to the sender and delete this copy from your system. Thank you.
>
> --
> 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>.
>
>
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> This e-mail may contain privileged and confidential information. If you are not the intended recipient, be aware that any use, disclosure, copying or distribution of this e-mail or any attachments is prohibited. If you have received this e-mail in error, please notify us immediately by returning it to the sender and delete this copy from your system. Thank you.
>
> --
> 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>.

Wei Lv

unread,
Mar 3, 2016, 6:23:40 AM3/3/16
to ode-users
Hi Bill,

Thanks for your response! I think with your conclusion, my question can come to an end.

Using a low pass filter is exactly what I did, and I'm happy you agree on it.

As for MOBY, I had been trying to build it for a while, but yes, it has not been maintained since 2012, and some of dependencies have been lost.

Wei Lv

在 2016年3月3日星期四 UTC+8下午6:58:26,wisellers写道:
Reply all
Reply to author
Forward
0 new messages