Linear motor as suspension spring

rockapat
Posts: 5
Joined: Tue Oct 20, 2020 8:03 am

Linear motor as suspension spring

Post by rockapat »

Hi!

I'm trying to do vehicle suspensions with a hinge2 but ran into a problem.

I've specified real values for mass of the chassis but the hinge2 spring used for the wheels cant support it, no matter how large value I specify for stiffness of the spring.

The chassi just sinks down to the lower limit of the spring.

The problem is easy to replicate in the hinge2vehicle example, just set the chassisMass to something large like 500.0 (instead of 2.0).

The hinge2 isn't supposed to work with that large masses?

Instead of the builtin hinge2 spring I've tried to use a generic6dof constraint and setting up the linear motor to act as a spring (since I think the motor has no problem supporting a large mass). Is that a reasonable way to do spring suspension for an articulated vehicle or have I missed something about the hinge2 constraint to get its spring working with heavy mass bodys?
rockapat
Posts: 5
Joined: Tue Oct 20, 2020 8:03 am

Re: Linear motor as suspension spring

Post by rockapat »

Hm the btGeneric6DofSpring2Constraint springy thing seems to work better than hinge2 with heavy bodys. I will experiment more with it instead.
rockapat
Posts: 5
Joined: Tue Oct 20, 2020 8:03 am

Re: Linear motor as suspension spring

Post by rockapat »

Nah, I spoke too soon. Back to "motorized springs".. :shock:

Can anyone confirm this (spring cant support the large chassi mass and the chassi will sink to the ground and stay there) with the following settings in the "Hinge2 Vehicle" in the examplebrowser (Hinge2Vehicle.cpp):

Code: Select all

	const btScalar chassisMass = 1000.0f; //Was 2.0f
	const btScalar wheelMass = 10.0f; //Was 1.0f
	.
	.
	.
		pHinge2->setDamping(2, 1000.0); //Was 2.0
		pHinge2->setStiffness(2, 10000.0); //Was 40.0
Oddly the spring works if I have the wheelMass to 1000.0f aswell as the chassisMass.

Is this normal behaviour for springs in bullet or do I have a bug in my code?