btGeneric6DofConstraint Angular Motors/Friction

Post Reply
peterk
Posts: 14
Joined: Mon Dec 15, 2008 6:52 pm

btGeneric6DofConstraint Angular Motors/Friction

Post by peterk »

Hi,

I'm attempting to use the btGeneric6DofConstraint to simulate a ball/point2point constraint with friction by enabling the angular motors with a target velocity of zero. The problem comes when trying to simulate a 2D grid of constrained bodies:

Code: Select all

B-B-B-B
| | | |
B-B-B-B
| | | |
B-B-B-B
| | | |
B-B-B-B
So each body is constrained to the adjacent bodies with a pivot at the mid point. The constraint pivot frame is initially set to the world frame. With this setup, if a constraint rotates by greater than some small angle (~pi/4) the entire system becomes unstable. This doesn't appear to be related to the maximum force on the motors although it is eliminated by increasing the constraint solver iterations, presumably because this limits the angle achieved between bodies.

My assumption is that this is some euler angle related problem, but I can't reproduce the issue with ODE and as far as I'm aware the angular motors in Bullet are a port of the ODE motors. I wondered if this could be more to do with differences between the ODE quickstep solver and Bullet's sequential impulse?

I'm going to continue to investigate but if anyone had any thoughts it would be appreciated. I can post code later to reproduce the issue.

Thanks.
peterk
Posts: 14
Joined: Mon Dec 15, 2008 6:52 pm

Re: btGeneric6DofConstraint Angular Motors/Friction

Post by peterk »

I've attached a hacked version of ConstraintDemo.cpp which exhibits the problem. Just fire a few cubes at the centre of the constraint array with the '.' key.
Attachments
ConstraintDemo.cpp
(10.63 KiB) Downloaded 374 times
peterk
Posts: 14
Joined: Mon Dec 15, 2008 6:52 pm

Re: btGeneric6DofConstraint Angular Motors/Friction

Post by peterk »

Ok, I've finally tracked this down to the fact that ODEs quickstep (optionally) randomly reorders non-contact constraints while Bullet's sequential impulse (optionally) randomly reorders non-contact constraints. Extending the bullet random constraint reordering code to handle non contact constraints fixes the issue.

Erwin: I can submit a patch for this if you'd like, it's only about 10 lines of copy/paste code though.
Post Reply