btContinuousDynamicsWorld

Milos
Posts: 4
Joined: Tue Jan 15, 2008 8:43 am

btContinuousDynamicsWorld

Post by Milos »

Hi.

Im doing my master thesis atm and Im constructing a vehicle with bullet using rigid bodies and constraints. And everything is fine (almost).

So here my problem. when setting the mass of the chassis (witch is connected to the wheels through a series of contraints and rigidbodies acting as suspension and steering controll) to above 100, I get jitter in my simulation,due to that the wheels penetrates the ground in some frames when the car stands still. After some research I think it relates to the the force applied on the wheels is to "great" (sorry for bad phrase). So a solution to this I think would be to use btContinuousDynamicsWorld. However, I quickly found that is not completed. So my question to u is: When do u plan to have a fully functional version of btContinuousDynamicsWorld? or do u have some other possible solution to my problem? atm bullet is running in 60hz with 200 iterations.

Thanks in advance.
Best regards
/Emil
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: btContinuousDynamicsWorld

Post by Erwin Coumans »

Milos wrote:Hi.

Im doing my master thesis atm and Im constructing a vehicle with bullet using rigid bodies and constraints. And everything is fine (almost).

So here my problem. when setting the mass of the chassis (witch is connected to the wheels through a series of contraints and rigidbodies acting as suspension and steering controll) to above 100, I get jitter in my simulation,due to that the wheels penetrates the ground in some frames when the car stands still. After some research I think it relates to the the force applied on the wheels is to "great" (sorry for bad phrase). So a solution to this I think would be to use btContinuousDynamicsWorld. However, I quickly found that is not completed. So my question to u is: When do u plan to have a fully functional version of btContinuousDynamicsWorld? or do u have some other possible solution to my problem? atm bullet is running in 60hz with 200 iterations.

Thanks in advance.
Best regards
/Emil
The problem is the large mass ratios between wheels and chassis. The btContinuousDynamicsWorld will not really solve this. This is one of the reasons most games use a fake raycast vehicle model (see bullet\src\BulletDynamics\Vehicle\btRaycastVehicle.h or VehicleDemo).

If you really want to use rigidbodies for wheels, we will need to add a special hinge constraint with suspension. You could port the Open Dynamics Engine dxJointHinge2 to Bullet constraint solver. This could be a very useful contribution to Bullet, do you have time for this?

See Hinge-2 in the ODE User Guide or check out the source code of joint.cpp.
through a series of contraints and rigidbodies acting as suspension and steering controll
Is there a way to reproduce your vehicle setup in a Bullet demo, and some picture/description of this series of constraints? That way we have some target for future improvements.
Thanks,
Erwin
Milos
Posts: 4
Joined: Tue Jan 15, 2008 8:43 am

Re: btContinuousDynamicsWorld

Post by Milos »

Hi again and thanks for the fast answer, and sorry for posting in the wrong forum :roll:

I will take a look at the ODE dxJointHinge2. However im (I think) getting the same results in my simulation. Im using several 6dofConstraints to simualte the suspension and steering. would love to share my ides with u but I'll have to check with the company im doing my thesis at first since I signed a confidential agreement.

Can u "flesh out" how the dxJointHinge2 removes the "jitter" when u have large mass ratios? Im sorry to say that Im a computer engineer and not much of a physicist. when I dont have large mass ratios my simulations work perfect.

And also I need the wheels to be rigid bodies due to that it is one major requierments of my thesis.

Edit: Also I must ask again, do u have some kind of hint when the btContinuousDynamicsWorld could be complete? I have a feeling that it would help me a lot.Since my defenition of CCD is that penetrations between rigid bodies will not occur(althougt I might be wrong). and also, will it work with GImpact?

I also tested to increase the gravity x10 in my stable scen (chassis = 100, wheels =10) and got the same jittering result as when having chassis mass 1000 and wheel mass 10. So something else then massratio seems to play a part here.

Best regards
/Emil
Milos
Posts: 4
Joined: Tue Jan 15, 2008 8:43 am

Re: btContinuousDynamicsWorld

Post by Milos »

kicking this thread back to life again.
Milos
Posts: 4
Joined: Tue Jan 15, 2008 8:43 am

Re: btContinuousDynamicsWorld

Post by Milos »

Hello again.
I think Ive found a way around this problem with jitter when using heavy rigid bodies.

Instead of increasing the mass of the chassis, I instead keep it at 100.
However when doing my rendering I just render every 10th frame and decrease the gravity to 0.1.
Or what Im really doing is that for every frame that's rendered I call the stepsimulation() 10 times.

This makes everything go in slow motion for the physics world but in the rendered world it looks ok.

Voila!
What I now get is a vehicle that act like it has a mass of 1000 but no jitter.
Evgeny
Posts: 3
Joined: Wed Feb 13, 2008 5:56 pm

Re: btContinuousDynamicsWorld

Post by Evgeny »

I have a similar problem with gravity and slow motion. it seems, that btRigidBody acceleration depends on it's mass. However gravity provides constant acceleration (9.81 m/s^2) independent of mass.
Am I wrong, that

Code: Select all

m_gravity = acceleration * (btScalar(1.0) / m_inverseMass);
must be changed to

Code: Select all

m_gravity = acceleration;
?
RobW
Posts: 33
Joined: Fri Feb 01, 2008 9:44 am

Re: btContinuousDynamicsWorld

Post by RobW »

No. The reason that gravity is multiplied by mass is because it will be divided by it again later.

e.g. Force += gravity * mass
Acceleration = Force / mass (Newton's 2nd law)

so in the end its equivalent to Acceleration = gravity (if there are no other forces).

So its just a little trick, most physics code does it.

Hope this helps :)
Evgeny
Posts: 3
Joined: Wed Feb 13, 2008 5:56 pm

Re: btContinuousDynamicsWorld

Post by Evgeny »

Evgeny wrote:Am I wrong, that
RobW wrote:Hope this helps :)
Yes, I was wrong, but I found the source of problem. When I call btRigidBody::setMassProps after the body was added to world, mass changes but gravity acceleration does not. It changes only when btRigidBody::setGravity is called. So all of us must call setGravity after setMassProps to get reliable simulation.
And there is another issue - getGravity will never return the same value that was an argument of setGravity unless the mass is not equal to 1. This is because getGravity returns value multiplied on mass. This is missdesign from my point of view.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: btContinuousDynamicsWorld

Post by Erwin Coumans »

Evgeny wrote: Yes, I was wrong, but I found the source of problem. When I call btRigidBody::setMassProps after the body was added to world, mass changes but gravity acceleration does not. It changes only when btRigidBody::setGravity is called. So all of us must call setGravity after setMassProps to get reliable simulation.
And there is another issue - getGravity will never return the same value that was an argument of setGravity unless the mass is not equal to 1. This is because getGravity returns value multiplied on mass. This is missdesign from my point of view.
Thanks for the feedback. Both are valid issues/bugs and should be fixed. They are added to the issue tracker, so you can track the progress: http://code.google.com/p/bullet/issues/detail?id=23

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

Re: btContinuousDynamicsWorld

Post by Erwin Coumans »

So my question to u is: When do u plan to have a fully functional version of btContinuousDynamicsWorld?
It has been filed in the issue tracker. It is about time we get btContinuousDynamicsWorld in a working state.

http://code.google.com/p/bullet/issues/detail?id=22
Thanks,
Erwin