btMultiBodyJointLimitConstraint produces unstable multibody

Post Reply
ryu
Posts: 2
Joined: Sun Mar 23, 2014 1:38 pm

btMultiBodyJointLimitConstraint produces unstable multibody

Post by ryu »

Hi,

First of all, thanks a lot for the btMultiBody, I think it's a great feature. I have been playing with it, and found some strange behavior when I enable limit constraints. I attached a file based on FeatherstoneMultiBodyDemo.cpp that reproduces the error I have been seeing. It is a very simple multibody with just two pieces. Steps to reproduce:

1. Open the demo
2. Grab the object and make it fall on the side
Expected:
- Stays on the floor, still
Actual:
- It starts rotating randomly

Another test that can be done is to comment out the following line:

Code: Select all

  limitCons->setMaxAppliedImpulse(40);
In this case (I assume it uses a maxImpulse of 100), even though the constraint allows for 180 degrees of rotation, it stays fixed in one of the limits, and there is no way to make it turn.

I also reproduced the strange behavior by creating the whole scene in Z-UP mode (with gravity [0,0,-10]) instead of Y-UP, and in this case I don't even need to make it fall on the side, it keeps rotating while standing on the base of the cylinder (and eventually falls by itself).

Am I using the API wrong? Or is it a bug?

Also, if I may make a suggestion, please add an API to set link colliders, having to do the following is unintuitive, given that there is an API for the base:

Code: Select all

  multiBody->getLink(linkIndex).m_collider = linkCollider;
Thanks!
Attachments
Featherstone2.cpp
Example to reproduce the observed behavior.
(10.45 KiB) Downloaded 255 times
benelot
Posts: 350
Joined: Sat Jul 04, 2015 10:33 am
Location: Bern, Switzerland
Contact:

Re: btMultiBodyJointLimitConstraint produces unstable multib

Post by benelot »

This problem seems to be resolved. At least I can not reproduce it by adding:

Code: Select all

		int linkIndex = 2;
	// Link joint limits
	btMultiBodyConstraint* limitCons = new btMultiBodyJointLimitConstraint(
		pMultiBody, linkIndex, -1.6, 1.6);
	// The default value (100) behaves like a lock on -1.6
//	limitCons->setMaxAppliedImpulse(40);
	pWorld->addMultiBodyConstraint(limitCons);
to the current MultiDoF demo. Somewhere after finalizeMultiBody in the method:

Code: Select all

btMultiBody* MultiDofDemo::createFeatherstoneMultiBody_testMultiDof(btMultiBodyDynamicsWorld *pWorld, int numLinks,const btVector3 &basePosition, const btVector3 &baseHalfExtents,const btVector3 &linkHalfExtents, bool spherical, bool floating)
ryu
Posts: 2
Joined: Sun Mar 23, 2014 1:38 pm

Re: btMultiBodyJointLimitConstraint produces unstable multib

Post by ryu »

Thanks!

I can't reproduce it anymore either. Seems resolved.
And in general, btMultiBody seems much more robust recently.
benelot
Posts: 350
Joined: Sat Jul 04, 2015 10:33 am
Location: Bern, Switzerland
Contact:

Re: btMultiBodyJointLimitConstraint produces unstable multib

Post by benelot »

True, I have the same feeling that it is a lot more robust. However the proper control of a spherical joint similar to a btGeneric6DoFJoint does not work so great yet it seems. Also I am lacking the limits there. What a pity!
Post Reply