Make wheels spin down slowly once off the ground
This commit is contained in:
parent
1a0537e493
commit
a26a5d741b
3 changed files with 31 additions and 14 deletions
|
@ -181,7 +181,7 @@ void Gear::setGlobalGround(double *global_ground, float* global_vel,
|
|||
_global_x = globalX;
|
||||
_global_y = globalY;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void Gear::getPosition(float* out)
|
||||
{
|
||||
|
@ -282,13 +282,25 @@ float Gear::getBumpAltitude()
|
|||
return h*(1/8.)*_ground_bumpiness*maxGroundBumpAmplitude;
|
||||
}
|
||||
|
||||
void Gear::integrate(float dt)
|
||||
{
|
||||
// Slowly spin down wheel
|
||||
if (_rollSpeed > 0) {
|
||||
// The brake factor of 13.0 * dt was copied from JSBSim's FGLGear.cpp and seems to work reasonably.
|
||||
// If more precise control is needed, then we need wheel mass and diameter parameters.
|
||||
_rollSpeed -= (13.0 * dt + 1300 * _brake * dt);
|
||||
if (_rollSpeed < 0) _rollSpeed = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void Gear::calcForce(RigidBody* body, State *s, float* v, float* rot)
|
||||
{
|
||||
// Init the return values
|
||||
int i;
|
||||
for(i=0; i<3; i++) _force[i] = _contact[i] = 0;
|
||||
|
||||
// Don't bother if it's not down
|
||||
// Don't bother if gear is retracted
|
||||
if(_extension < 1)
|
||||
{
|
||||
_wow = 0;
|
||||
|
@ -328,7 +340,6 @@ void Gear::calcForce(RigidBody* body, State *s, float* v, float* rot)
|
|||
_wow = 0;
|
||||
_frac = 0;
|
||||
_compressDist = 0;
|
||||
_rollSpeed = 0;
|
||||
_casterAngle = 0;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -70,6 +70,7 @@ public:
|
|||
float getBumpAltitude();
|
||||
bool getGroundIsSolid();
|
||||
float getGroundFrictionFactor() { return (float)_ground_frictionFactor; }
|
||||
void integrate(float dt);
|
||||
|
||||
// Takes a velocity of the aircraft relative to ground, a rotation
|
||||
// vector, and a ground plane (all specified in local coordinates)
|
||||
|
|
|
@ -136,6 +136,11 @@ void Model::initIteration()
|
|||
_turb->offset(toff);
|
||||
}
|
||||
|
||||
for(i=0; i<_gears.size(); i++) {
|
||||
Gear* g = (Gear*)_gears.get(i);
|
||||
g->integrate(_integrator.getInterval());
|
||||
}
|
||||
|
||||
for(i=0; i<_hitches.size(); i++) {
|
||||
Hitch* h = (Hitch*)_hitches.get(i);
|
||||
h->integrate(_integrator.getInterval());
|
||||
|
|
Loading…
Reference in a new issue