From c696151181bfb6fcacdafa2c90740713aa5f23ba Mon Sep 17 00:00:00 2001 From: GoT Date: Mon, 14 Mar 2022 12:23:18 +0100 Subject: [PATCH] Prevent double declaration --- src/utility/quaternionFilters.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/utility/quaternionFilters.cpp b/src/utility/quaternionFilters.cpp index 64b6a9b7..ae992538 100644 --- a/src/utility/quaternionFilters.cpp +++ b/src/utility/quaternionFilters.cpp @@ -32,7 +32,7 @@ static float GyroMeasError = PI * (40.0f / 180.0f); // the faster the solution converges, usually at the expense of accuracy. // In any case, this is the free parameter in the Madgwick filtering and // fusion scheme. -static float beta = sqrt(3.0f / 4.0f) * GyroMeasError; // Compute beta +static float gyro_beta = sqrt(3.0f / 4.0f) * GyroMeasError; // Compute beta // Compute zeta, the other free parameter in the Madgwick scheme usually // set to a small or zero value // static float zeta = sqrt(3.0f / 4.0f) * GyroMeasDrift; @@ -120,10 +120,10 @@ void MadgwickQuaternionUpdate(float ax, float ay, float az, float gx, float gy, s4 *= norm; // Compute rate of change of quaternion - qDot1 = 0.5f * (-q2 * gx - q3 * gy - q4 * gz) - beta * s1; - qDot2 = 0.5f * (q1 * gx + q3 * gz - q4 * gy) - beta * s2; - qDot3 = 0.5f * (q1 * gy - q2 * gz + q4 * gx) - beta * s3; - qDot4 = 0.5f * (q1 * gz + q2 * gy - q3 * gx) - beta * s4; + qDot1 = 0.5f * (-q2 * gx - q3 * gy - q4 * gz) - gyro_beta * s1; + qDot2 = 0.5f * (q1 * gx + q3 * gz - q4 * gy) - gyro_beta * s2; + qDot3 = 0.5f * (q1 * gy - q2 * gz + q4 * gx) - gyro_beta * s3; + qDot4 = 0.5f * (q1 * gz + q2 * gy - q3 * gx) - gyro_beta * s4; // Integrate to yield quaternion q1 += qDot1 * deltat;