mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-19 09:09:05 +08:00
Modified estimator to fix internal GCC compiler error (hilarious 64bit handling), use float instead of double routines to avoid implicit casts
This commit is contained in:
parent
3c5bcf77cc
commit
40deb405c1
@ -1617,12 +1617,18 @@ void StoreStates(uint64_t timestamp_ms)
|
||||
// Output the state vector stored at the time that best matches that specified by msec
|
||||
void RecallStates(float (&statesForFusion)[n_states], uint64_t msec)
|
||||
{
|
||||
int64_t bestTimeDelta = 200;
|
||||
int bestTimeDelta = 200;
|
||||
unsigned bestStoreIndex = 0;
|
||||
for (unsigned storeIndex = 0; storeIndex < data_buffer_size; storeIndex++)
|
||||
{
|
||||
int64_t timeDelta = (int)msec - statetimeStamp[storeIndex];
|
||||
if (timeDelta < 0) timeDelta = -timeDelta;
|
||||
// The time delta can also end up as negative number,
|
||||
// since we might compare future to past or past to future
|
||||
// therefore cast to int64.
|
||||
int timeDelta = (int64_t)msec - (int64_t)statetimeStamp[storeIndex];
|
||||
if (timeDelta < 0) {
|
||||
timeDelta = -timeDelta;
|
||||
}
|
||||
|
||||
if (timeDelta < bestTimeDelta)
|
||||
{
|
||||
bestStoreIndex = storeIndex;
|
||||
@ -1739,9 +1745,9 @@ void OnGroundCheck()
|
||||
void calcEarthRateNED(Vector3f &omega, float latitude)
|
||||
{
|
||||
//Define Earth rotation vector in the NED navigation frame
|
||||
omega.x = earthRate*cos(latitude);
|
||||
omega.y = 0.0;
|
||||
omega.z = -earthRate*sin(latitude);
|
||||
omega.x = earthRate*cosf(latitude);
|
||||
omega.y = 0.0f;
|
||||
omega.z = -earthRate*sinf(latitude);
|
||||
}
|
||||
|
||||
void CovarianceInit()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user