Dropping an object from different heights

Post Reply
sara
Posts: 39
Joined: Thu Mar 24, 2011 3:50 pm

Dropping an object from different heights

Post by sara »

Hi everybody,

I'm trying to do a demo in which I drop a box from different heights, and I extract the impulse generated.

The problem I am having is that if I drop the box from 23 meters it generates more impulse than if I drop it from 24.
Here is the demo I am using, and some data I found:

Code: Select all

height: 23
mp[0] dis [-0.10828] imp [7.79799] at [0.0007]
mp[1] dis [-0.10828] imp [4.67879] at [0.0007]
mp[2] dis [-0.10828] imp [7.798] at [0.0007]
mp[3] dis [-0.10828] imp [4.6788] at [0.0007]
35648
height: 24
mp[0] dis [-0.052723] imp [7.31186] at [0.0007]
mp[1] dis [-0.052723] imp [4.38712] at [0.0007]
mp[2] dis [-0.052723] imp [7.31187] at [0.0007]
mp[3] dis [-0.052723] imp [4.38712] at [0.0007]
33425.7
You can change the height with '8' and '5', and restart the simulation with space.

I really need for the impulses to grow with the height...
Any ideas on why this happens and how can I fix it?
Attachments
BasicDemo.cpp
(9.67 KiB) Downloaded 391 times
BasicDemo.h
(2.67 KiB) Downloaded 355 times
kloplop321
Posts: 55
Joined: Sun Jan 01, 2012 7:37 pm

Re: Dropping an object from different heights

Post by kloplop321 »

Forces are an acceleration, so if the force is not present, the existing force is nothing and the body is left with a velocity.
As you collide and penetrate objects, the force is present that will make it no longer penetrate.
I think your problem is that you are sampling at times where the ball from 23 meters penetrates further than the one that is 24 meters. That would explain why you are measuring more.

I think the impulses that take place are correct, but the means that you measure by is incorrect.
sara
Posts: 39
Joined: Thu Mar 24, 2011 3:50 pm

Re: Dropping an object from different heights

Post by sara »

How should I measure to get the correct answer? How can I activate ccd so that I get always the correct impulses? (greater if the object is dropped from a higher height)

By the way, I don't care if the simulation is slow. If reducing the time step would help me, I would, but I tried that and I get the same results, only slower...
kloplop321
Posts: 55
Joined: Sun Jan 01, 2012 7:37 pm

Re: Dropping an object from different heights

Post by kloplop321 »

Reducing the time step does not change how the simulation acts, only how much it is interpolated between simulation points.
Those points are determined at the fixedTimeStep intervals.
Try changing the hertz at which it is simulated at.
stepSimulation (btScalar timeStep, int maxSubSteps=1, btScalar fixedTimeStep=btScalar(1.)/btScalar(60.))
http://bulletphysics.com/Bullet/BulletF ... World.html
By default, the last parameter is essentially 60Hz, try changing that to something like 480.

I am not able to look at your attached sources at this time.
sara
Posts: 39
Joined: Thu Mar 24, 2011 3:50 pm

Re: Dropping an object from different heights

Post by sara »

That is what I tried. I get the same results.
kloplop321
Posts: 55
Joined: Sun Jan 01, 2012 7:37 pm

Re: Dropping an object from different heights

Post by kloplop321 »

Are you trying to use Bullet for scientifically accurate simulations?
Its suggested not to do that, if you are.

All I can offer at this time is modify the constraint solver to get the information you need.
If it is the same values there as you are getting with your current implementation, then you'll either need to replace the constraint solver with more accurate math, or use another solution.
http://bulletphysics.com/Bullet/BulletF ... tml#l00094
I think that's the function you should be interested in logging.
sara
Posts: 39
Joined: Thu Mar 24, 2011 3:50 pm

Re: Dropping an object from different heights

Post by sara »

wow, I didn't know it was going to be that complicated. You are right, I am trying to get scientific data for my application.

I'll look into the function.

Thanks!!
mi076
Posts: 144
Joined: Fri Aug 01, 2008 6:36 am
Location: Bonn, Germany

Re: Dropping an object from different heights

Post by mi076 »

What you get with getAppliedImpulse() is the recently applied impulse to satisfy contact constraints,
it is not what you need. Anyway, you could also try to switch m_dynamicsWorld->getSolverInfo().m_splitImpulse = 1 / 0 in your experiments.
Also you are calculating force=impulse/timeStep. It doesn't work well for particular case, timeStep is not the time objects interacted with each other, it is just time between two frames. Try compare impulses for now.
But it will not really improve the crap. What you need is the velocity just before (may be one frame before?) the impact. Bullet can do it well. You may need air resistance to get more realistic velocity values, it depends...Knowing the velocity you can figure out yourself the kinetic energy of the impact and the force of impact, based on (elastic) properties of the objects.

Edit: the function kloplop321 mentioned is interesting, i haven't seen the post because here are two identical threads, it is wrong.
sara
Posts: 39
Joined: Thu Mar 24, 2011 3:50 pm

Re: Dropping an object from different heights

Post by sara »

I used the splitImpulse mi076 said, and modified btSequentialImpulseContraintSolver.cpp so it does not take the penetration into account to calculate the impulse.

So what it is doing now is only calculate the impulse using the velocity the object has.

It hasn't totally fix the problem, but the impulse is more accurate.

Thanks everybody!
Post Reply