Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

d000hg

Problems with box resting on 4 springs - unstable

This topic is 5124 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m implementing suspension for my racing game, currently by putting a simple hooke''s law spring on each corner of the base of the car (a uniform box right now). While the springs are working if I make them apply a force upward on the car through it''s CofM ie no torque, even on a totally flat surface if they apply their force to the actual corner of the car they''re attached to it suddenly flips over or similarly bad things happen. The cae is being dropped a small distance, but I can''t come up with a physical explanation why even if the ground was being treated as very slightly uneven (floating point rounding errors for instance), this would happen. Any ideas, other than a stupid bug somewhere like I''m applying the force to the wrong point!?

Share this post


Link to post
Share on other sites
Advertisement
Using my psychic powers, I can tell you with 100% accuracy that you''re applying the torque in the opposite direction to the direction in which it should be applied. That way you get a positive feedback loop, and it all goes blooie.

Of course, with more data, it may be possible to refine this statement.

Share this post


Link to post
Share on other sites
You might also want to dampen your shocks.

I gather car shocks are best if critically damped... though figuring out the relevant physical characteristics of the car might be difficult, as there are rotational as well as vertical motions... It''d probly be ok to just damped critically for pure vertical oscillation.

http://mathworld.wolfram.com/DampedSimpleHarmonicMotionCriticalDamping.html

Share this post


Link to post
Share on other sites
While damping IS something I need to implement (currently I drop my car and it bounces up and down indefinitely) That should not be a factor here - if it fixed the problem it would just be a lucky fudge. I determined If I apply a force of 9.81*M*0.25 at each suspension spring (ie 1/4 of force due to gravity) it does hover as expected. So the problem must be the way I get contact data about the ground.

Share this post


Link to post
Share on other sites
I don't understand this 1/4*m*g idea. Here is how it should be done:

This is a wheel-free version, a body with 4 springs:

You should have 5 objects: 1 rigid body, and 4 spring-dampers.
forces acting on the body: gravity at the center of mass; and at each spring-damper's body-end a force according to the length of the spring (if you use dampers too, then it is calculated from the relative speed of the ends of the spring-damper).
These 5 forces act on the body, four of them (the springs) create torque too.
The best solution to handle this situation is having a rigidBody class which has an ApplyForce() method, it's parameters are the location in body coordinates, and the force vector. And this class also has a force, and a torque member variables in which you add the acting forces and the torques (calculated from forces and locations) together. At the beginning of every frame you zero the torque and force variables, and only the applyForce() method can modify their values. When all the neccesary forces are applied on the object, then you can calculate acceleration, and angular acceleration of it, and then integrate with some accurate method.

If you think you could make it available, so that we can see the problem, provided you can.


[edited by - szinkopa on May 8, 2004 1:35:02 PM]

Share this post


Link to post
Share on other sites
The way you describe is essentially the exact way I am using. The 1/4mg thing was a simple test that the forces were being applied at the right position and the torques calculated correctly. I was just applying 1/4 of the force from gravity at each spring upwards. Since the box is uniform that means the net force and torque should be zero. Since this was the observed effect, I eliminated these as problems; instead it must be where I calculate the force for each spring from the spring/ground interaction.

Share this post


Link to post
Share on other sites
What integration scheme are you using? I hope its not simple Euler (which goes unstable with springs), .

Graham Rhodes
Principal Scientist
Applied Research Associates, Inc.

Share this post


Link to post
Share on other sites
Currently I am using a very simple system. The spring gets its compression by essentially dropping a perpendicular from the corner of the car, length=L. How far this penetrates the ground determines how much the spring is being squashed and hence the restoring force.

Currently for each physics update (0.01s) I get the position of the car-corner at the start, and it''s linear velocity+acceleration which gets an estimate of its position at the end of the update using p2=p1 + v*dt + 0.5*a*dt*dt. Then I drop the perpendiculars from these two positions, getting two compression values which are averaged to give the value for the frame. So not a particularly accurate model but for my timestep pretty good - I can drop the car and it bounces for minutes with no change in height reached (no damping yet) which indicates good accuracy.

What integration model would you suggest for this situation?

And to everyone, what kind of damping value is suitable assuming the damping force is F=-bv where v is velocity? Car mass around 500-1000Kg, spring length around 0.5m (using spring consrant of about 30000).

Share this post


Link to post
Share on other sites
the damping constant should be defined to a value, with which the car almost stops moving within 2 periods. I suggest trying certain values and see if it is similar to reality. Begin with 2000 (in SI).

[edited by - szinkopa on May 11, 2004 8:25:22 AM]

Share this post


Link to post
Share on other sites
Thanks, 2000 was a pretty good guess! Aparently for critical damping the constant=2*m*w where w is natural angualar frequency of undamped system and m the mass on the end of the spring (which I''ll take as 1/4 the car''s mass).

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!