revert accidental checkin
This commit is contained in:
parent
f52165731a
commit
7f546e94d3
1 changed files with 6 additions and 16 deletions
|
@ -28,8 +28,6 @@ const float STHRESH = 1;
|
||||||
// oscillate.
|
// oscillate.
|
||||||
const float SOLVE_TWEAK = 0.3226;
|
const float SOLVE_TWEAK = 0.3226;
|
||||||
|
|
||||||
const float GRAV = 9.8f;
|
|
||||||
|
|
||||||
Airplane::Airplane()
|
Airplane::Airplane()
|
||||||
{
|
{
|
||||||
_emptyWeight = 0;
|
_emptyWeight = 0;
|
||||||
|
@ -125,7 +123,7 @@ void Airplane::getPilotAccel(float* out)
|
||||||
|
|
||||||
// Gravity
|
// Gravity
|
||||||
Glue::geodUp(s->pos, out);
|
Glue::geodUp(s->pos, out);
|
||||||
Math::mul3(GRAV, out, out);
|
Math::mul3(-9.8f, out, out);
|
||||||
|
|
||||||
// The regular acceleration
|
// The regular acceleration
|
||||||
float tmp[3];
|
float tmp[3];
|
||||||
|
@ -595,7 +593,7 @@ void Airplane::compileContactPoints()
|
||||||
// Give it a spring constant such that at full compression it will
|
// Give it a spring constant such that at full compression it will
|
||||||
// hold up 10 times the planes mass. That's about right. Yeah.
|
// hold up 10 times the planes mass. That's about right. Yeah.
|
||||||
float mass = _model.getBody()->getTotalMass();
|
float mass = _model.getBody()->getTotalMass();
|
||||||
float spring = (1/DIST) * GRAV * 10.0f * mass;
|
float spring = (1/DIST) * 9.8f * 10.0f * mass;
|
||||||
float damp = 2 * Math::sqrt(spring * mass);
|
float damp = 2 * Math::sqrt(spring * mass);
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
@ -787,7 +785,6 @@ void Airplane::setupWeights(bool isApproach)
|
||||||
|
|
||||||
void Airplane::runCruise()
|
void Airplane::runCruise()
|
||||||
{
|
{
|
||||||
__builtin_printf("runCruise()\n");
|
|
||||||
setupState(_cruiseAoA, _cruiseSpeed,_approachGlideAngle, &_cruiseState);
|
setupState(_cruiseAoA, _cruiseSpeed,_approachGlideAngle, &_cruiseState);
|
||||||
_model.setState(&_cruiseState);
|
_model.setState(&_cruiseState);
|
||||||
_model.setAir(_cruiseP, _cruiseT,
|
_model.setAir(_cruiseP, _cruiseT,
|
||||||
|
@ -831,7 +828,6 @@ void Airplane::runCruise()
|
||||||
|
|
||||||
void Airplane::runApproach()
|
void Airplane::runApproach()
|
||||||
{
|
{
|
||||||
__builtin_printf("runApproach()\n");
|
|
||||||
setupState(_approachAoA, _approachSpeed,_approachGlideAngle, &_approachState);
|
setupState(_approachAoA, _approachSpeed,_approachGlideAngle, &_approachState);
|
||||||
_model.setState(&_approachState);
|
_model.setState(&_approachState);
|
||||||
_model.setAir(_approachP, _approachT,
|
_model.setAir(_approachP, _approachT,
|
||||||
|
@ -940,7 +936,7 @@ void Airplane::solve()
|
||||||
runCruise();
|
runCruise();
|
||||||
|
|
||||||
_model.getThrust(tmp);
|
_model.getThrust(tmp);
|
||||||
float thrust = tmp[0] + GRAV * _cruiseWeight * Math::sin(_cruiseGlideAngle);
|
float thrust = tmp[0] + _cruiseWeight * Math::sin(_cruiseGlideAngle) * 9.81;
|
||||||
|
|
||||||
_model.getBody()->getAccel(tmp);
|
_model.getBody()->getAccel(tmp);
|
||||||
Math::tmul33(_cruiseState.orient, tmp, tmp);
|
Math::tmul33(_cruiseState.orient, tmp, tmp);
|
||||||
|
@ -981,7 +977,7 @@ void Airplane::solve()
|
||||||
float pitch1 = tmp[1];
|
float pitch1 = tmp[1];
|
||||||
|
|
||||||
// Now calculate:
|
// Now calculate:
|
||||||
float awgt = GRAV * _approachWeight;
|
float awgt = 9.8f * _approachWeight;
|
||||||
|
|
||||||
float dragFactor = thrust / (thrust-xforce);
|
float dragFactor = thrust / (thrust-xforce);
|
||||||
float liftFactor = awgt / (awgt+alift);
|
float liftFactor = awgt / (awgt+alift);
|
||||||
|
@ -989,10 +985,8 @@ void Airplane::solve()
|
||||||
float tailDelta = -pitch0 * (ARCMIN/(pitch1-pitch0));
|
float tailDelta = -pitch0 * (ARCMIN/(pitch1-pitch0));
|
||||||
|
|
||||||
// Sanity:
|
// Sanity:
|
||||||
if(dragFactor <= 0 || liftFactor <= 0) {
|
if(dragFactor <= 0 || liftFactor <= 0)
|
||||||
__builtin_printf("NEGATIVE drag %f lift %f\n", dragFactor, liftFactor);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
// And the elevator control in the approach. This works just
|
// And the elevator control in the approach. This works just
|
||||||
// like the tail incidence computation (it's solving for the
|
// like the tail incidence computation (it's solving for the
|
||||||
|
@ -1011,7 +1005,7 @@ void Airplane::solve()
|
||||||
// Now apply the values we just computed. Note that the
|
// Now apply the values we just computed. Note that the
|
||||||
// "minor" variables are deferred until we get the lift/drag
|
// "minor" variables are deferred until we get the lift/drag
|
||||||
// numbers in the right ballpark.
|
// numbers in the right ballpark.
|
||||||
__builtin_printf("Apply drag %f lift %f\n", dragFactor, liftFactor);
|
|
||||||
applyDragFactor(dragFactor);
|
applyDragFactor(dragFactor);
|
||||||
applyLiftRatio(liftFactor);
|
applyLiftRatio(liftFactor);
|
||||||
|
|
||||||
|
@ -1022,8 +1016,6 @@ void Airplane::solve()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
__builtin_printf("Apply aoa %f tail %f\n", SOLVE_TWEAK*aoaDelta, SOLVE_TWEAK*tailDelta);
|
|
||||||
|
|
||||||
// OK, now we can adjust the minor variables:
|
// OK, now we can adjust the minor variables:
|
||||||
_cruiseAoA += SOLVE_TWEAK*aoaDelta;
|
_cruiseAoA += SOLVE_TWEAK*aoaDelta;
|
||||||
_tailIncidence += SOLVE_TWEAK*tailDelta;
|
_tailIncidence += SOLVE_TWEAK*tailDelta;
|
||||||
|
@ -1040,8 +1032,6 @@ void Airplane::solve()
|
||||||
if(abs(elevDelta) < STHRESH*0.0001)
|
if(abs(elevDelta) < STHRESH*0.0001)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
__builtin_printf("Apply elev %f\n", SOLVE_TWEAK*elevDelta);
|
|
||||||
|
|
||||||
// Otherwise, adjust and do the next iteration
|
// Otherwise, adjust and do the next iteration
|
||||||
_approachElevator.val += SOLVE_TWEAK * elevDelta;
|
_approachElevator.val += SOLVE_TWEAK * elevDelta;
|
||||||
if(abs(_approachElevator.val) > 1) {
|
if(abs(_approachElevator.val) > 1) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue