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
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
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"
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
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.
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
Dear Wei,
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
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.
Visit this group at https://groups.google.com/group/ode-users.
For more options, visit https://groups.google.com/d/optout.
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:
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 feedbackfor (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));}elsecolPol->mSensorVector[i]->numFeedbacks++;}}}}}}}}
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: