Difference between Non-Featherstone and Featherstone

Post Reply
benelot
Posts: 350
Joined: Sat Jul 04, 2015 10:33 am
Location: Bern, Switzerland
Contact:

Difference between Non-Featherstone and Featherstone

Post by benelot »

If I simulate 2 simple constrained objects I get a significant difference in how fast they drop due to gravity. I just use two boxes and constraint them with a hinge constraint. The featherstone multibody version of it somehow falls much slower.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Difference between Non-Featherstone and Featherstone

Post by Erwin Coumans »

Did you set the linear damping of the btMultiBody to zero, using mb->setLinearDamping(0);?

I can't reproduce this issue. Can you reproduce it by modifying one of the examples in the Bullet Example Browser using latest version of Bullet at http://github.com/bulletphysics/bullet3?

I modified the ImportURDFSetup and created a copy of r2d2.urdf using rigid body (+ constraints) and btMultiBody. They fall at the same speed.

Around line 250 of ImportURDFSetup.cpp:

Code: Select all

int rootLinkIndex = u2b.getRootLinkIndex();
			b3Printf("urdf root link index = %d\n",rootLinkIndex);
			MyMultiBodyCreator creation(m_guiHelper);

            {
                bool useMultiBody = false;
                btTransform startTrans;
                startTrans.setIdentity();
                startTrans.setOrigin((btVector3(3,-2,3)));
                ConvertURDF2Bullet(u2b,creation, startTrans,m_dynamicsWorld,useMultiBody,u2b.getPathPrefix());
                mb = creation.getBulletMultiBody();
                
            }
            {
                bool useMultiBody = true;
                btTransform startTrans;
                startTrans.setIdentity();
                startTrans.setOrigin((btVector3(0,-2,3)));
                ConvertURDF2Bullet(u2b,creation, startTrans,m_dynamicsWorld,useMultiBody,u2b.getPathPrefix());
                mb = creation.getBulletMultiBody();
               if (mb)
                  mb->setLinearDamping(0);

            }
			if (m_useMultiBody && mb )
			{


Print out the base position for btMultiBody and position of first rigid body (assume root link comes first in the URDF)

Code: Select all

void ImportUrdfSetup::stepSimulation(float deltaTime)
{
//...
	//the maximal coordinates/iterative MLCP solver requires a smallish timestep to converge
		m_dynamicsWorld->stepSimulation(deltaTime,10,1./240.);
        for (int i=0;i<m_dynamicsWorld->getNumMultibodies();i++)
        {
            btVector3 pos = m_dynamicsWorld->getMultiBody(i)->getBaseWorldTransform().getOrigin();
            b3Printf("multiBody [%f] pos = %f,%f,%f\n",pos[0],pos[1],pos[2]);
        }
        for (int i=0;i<m_dynamicsWorld->getNumCollisionObjects();i++)
        {
            btRigidBody* rb = btRigidBody::upcast(m_dynamicsWorld->getCollisionObjectArray()[i]);
            if (rb)
            {
                btVector3 pos = rb->getWorldTransform().getOrigin();
                b3Printf("rigidBody [%f] pos = %f,%f,%f\n",pos[0],pos[1],pos[2]);
                break;
            }
        }
}
comparison2.png
comparison2.png (128.65 KiB) Viewed 3619 times
benelot
Posts: 350
Joined: Sat Jul 04, 2015 10:33 am
Location: Bern, Switzerland
Contact:

Re: Difference between Non-Featherstone and Featherstone

Post by benelot »

Hi,

Thanks Erwin for that input, it was the linear damping. I thought linear damping would only affect the linear movement of a slider joint, but it seems that it damps the fall due to gravity as well. To me that was slightly misleading. Does the same hold for the multibody rotation with the angular damping? Can you set up the damping of the joint movement somewhere else or is there no equivalent to setDamping of the joints in the non-featherstone case?
Post Reply