Stabilize "dantzing" on nearby contacts using custom combiner callback.

Post Reply
Dox
Posts: 24
Joined: Thu Oct 18, 2018 5:16 pm

Stabilize "dantzing" on nearby contacts using custom combiner callback.

Post by Dox » Thu May 02, 2019 2:33 pm

Hello,

Look at this short video:

https://drive.google.com/open?id=1M1E6R ... nkYB0IY9YZ

There is a manipulator that grab an anchor. The anchor and the arm fingers are represented by convex hull shapes (from HACD). Moving with the grabbed anchor we can see some "dantzing".

I think this is mainly do by the "ping pong" collisions that happens between fingers and anchor. This assumption is correct?

NOTE: because others limitations, I need to use the btSequentialImpulse solver (with a time step of 1/240). I can't use the MLCP dantzing solver (I don't know if this one can really solve this case).

I have a custom combiner callback and I'm able to catch the collision event between objects.

I've tried to setup the m_appliedImpulse really low (0.0001) in the collision btManifoldPoint, but seems there is no changes. No other luck with others parameters like m_appliedImpulseLateral1, m_appliedImpulseLateral2 and m_combinedContactDamping1, but I'm not really confident to their meaning and values.

Can I tweak some other collision parameter in order to reduce or eliminate this behavior?

Have you some advises for me, or simply is not possible to change this behavior?

Many thanks,

Bye

User avatar
drleviathan
Posts: 540
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: Stabilize "dantzing" on nearby contacts using custom combiner callback.

Post by drleviathan » Thu May 02, 2019 3:26 pm

Yes, it looks like the anchor is ping-ponging between the fingers.

Is the grabber object dynamic or kinematic? If kinematic: are you setting its linearVelocity to agree with their true effective motion? or are you just slamming their position with zero linearVelocity? Setting the velocity correctly will tend to reduce/prevent interpenetration events and make for more correct collision points and response.

If dynamic and being controlled by impulses then the anchor's motion would tend to smooth out as the ratio of masses between the two objects gets closer to 1.0. That is to say: when one object's mass is much much larger than the other's you tend to get "non-physical" results in a discrete physics simulation. If the masses are not adjustable then the best way to solve this problem is to go to smaller timesteps, but you're already pretty small at 1/240.

Some other ideas:

(1) Reduce the restitution (bounciness) of the anchor and grabber. Try restitution = 0.0 and if that helps either leave it there or dial it up to just below where the problem starts to occur.

(2) Did you compute the inertia tensor of the anchor correctly? It looks like it wants to "spin" too fast in its collision response which would mean its inertia is too low for its true shape. Try scaling the inertia tensor up by a factor of 2, 4, 8 to see if that helps smooth the anchor's motion.

(3) Since you are under water it might make sense to increase the angular and linear damping coefficients.

Dox
Posts: 24
Joined: Thu Oct 18, 2018 5:16 pm

Re: Stabilize "dantzing" on nearby contacts using custom combiner callback.

Post by Dox » Thu May 02, 2019 4:13 pm

Hello drleviathan,

The manipulator hand is a kinematic group attached to the a dynamic group, a kind of "scripted kinematic" you have suggested to me some post ago. In fact the anchor is dynamic and the arm is kinematic, so this is kinematic <-> dynamic interaction.

I'm NOT setting the linearVelocity...the kinematic manipulator get the position via its motion state. Can you tell me the correct way to set the linearVelocity for a kinematic entity?

1. I'll try ASAP: do you means the m_restitution variable in the MotionState, right?

2. I don't do "specific" calculus for the anchor: simply I get the btCollisionShape (a btCompoundShape that incapsulate the convex hull verticies) and then I recall the 'calculateLocalInertia(l_mass, l_local_inertia)'. Have you some specific suggestions in this case?

3. Yes I'm playing now around angular and linear damping coeffs. For the underwater vehicle I have a specific physic calculus in order to simulate the presence of water but not for others objects (like the anchor).

Many thanks, bye

User avatar
Erwin Coumans
Site Admin
Posts: 4184
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Stabilize "dantzing" on nearby contacts using custom combiner callback.

Post by Erwin Coumans » Thu May 02, 2019 4:28 pm

For robotics purposes we developed the btMultiBody and PyBullet and its C and C++ robotics API. You may want to try btMultiBody instead of btRigidBody,
and PyBullet/C++ robotics API has most of the settings more suitable for such tasks.

So I suggest to create a quick prototype in PyBullet and then re-do your thing in C++.

Good luck!

User avatar
drleviathan
Posts: 540
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: Stabilize "dantzing" on nearby contacts using custom combiner callback.

Post by drleviathan » Thu May 02, 2019 5:51 pm

Ok, so the Arm is kinematic and attached to another object I'll call Submersible. If the velocities (linear and angular) of the submersible are known then assuming zero local velocities relative to the Submerisble you can compute the velocities of the attached Arm like so:

Code: Select all

armLinearVelocity = submersibleLinearVelocity + submersibleAngularVelocity.cross(armOffsetFromSubmersibleInWorldFrame);
You can slam the velocity of kinematic bodies directly. Maybe do it inside your MotionState::setWorldTransform(). It shouldn't actually affect the motion of the body over time (assuming your MotionState is not actually using the linearVelocity when computing the new transform in MotionState::getWorldTransform())... instead it just sets the velocity to be correct for that frame when it comes to computing results of collisions on dynamic things: dynamic things will tend to have more correct response velocities from the collisions.

Code: Select all

body->setLinearVelocity(armLinearVelocity);
(1) To set the restitution you just need to do this once:

Code: Select all

body->setRestitution(newValue);
(2) Assume the inertia tensor is correct, but you could play with scaling it up by a factor of 2, 4, 8 to see how it affects the physics. Maybe try this last if other methods don't work.

(3) Since you aren't increasing damping for other dynamic bodies in the water yet, you should try it to see what effect it has.

Post Reply