1
0
Fork 0

Fix YASim's /accelerations/pilot/{x,y,z}-accel-fps_sec computations. These

are the accelerations (forces) as felt from the pilot's perspective.  This
combines the accelerations due to change in velocity vector and gravity.

Previosly the gravity part was right, but the body accelerations were being
transformed incorrectly.  The error was very subtle and basically amounted to
the fact that inverting an axis of a vector before transforming it is not
equivalent to transforming the vector and then inverting that axis.

After this fix, pilot accelerations + gyro + gps can be fed into an external
kalman filter and it will converge properly (extra confirmation that there
was a problem and this fix corrects it.)
This commit is contained in:
Curtis L. Olson 2012-01-04 19:17:32 -06:00
parent af150d1a56
commit cf86d37514
2 changed files with 8 additions and 5 deletions

View file

@ -126,14 +126,17 @@ void Airplane::getPilotAccel(float* out)
// Gravity // Gravity
Glue::geodUp(s->pos, out); Glue::geodUp(s->pos, out);
Math::mul3(-9.8f, out, out); Math::mul3(-9.8f, out, out);
Math::vmul33(s->orient, out, out);
out[0] = -out[0];
// The regular acceleration // The regular acceleration
float tmp[3]; float tmp[3];
Math::mul3(-1, s->acc, tmp);
Math::add3(tmp, out, out);
// Convert to aircraft coordinates // Convert to aircraft coordinates
Math::vmul33(s->orient, out, out); Math::vmul33(s->orient, s->acc, tmp);
tmp[1] = -tmp[1];
tmp[2] = -tmp[2];
Math::add3(tmp, out, out);
// FIXME: rotational & centripetal acceleration needed // FIXME: rotational & centripetal acceleration needed
} }

View file

@ -448,7 +448,7 @@ void YASim::copyFromYASim()
_set_Accels_CG_Body(M2FT*v[0], -M2FT*v[1], -M2FT*v[2]); _set_Accels_CG_Body(M2FT*v[0], -M2FT*v[1], -M2FT*v[2]);
_fdm->getAirplane()->getPilotAccel(v); _fdm->getAirplane()->getPilotAccel(v);
_set_Accels_Pilot_Body(-M2FT*v[0], M2FT*v[1], M2FT*v[2]); _set_Accels_Pilot_Body(M2FT*v[0], M2FT*v[1], M2FT*v[2]);
// There is no property for pilot G's, but I need it for a panel // There is no property for pilot G's, but I need it for a panel
// instrument. Hack this in here, and REMOVE IT WHEN IT FINDS A // instrument. Hack this in here, and REMOVE IT WHEN IT FINDS A