Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 819a1f9

Browse files
authoredMar 20, 2022
Prevent double declaration
Prevent double declaration
2 parents aa98efa + c696151 commit 819a1f9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed
 

‎src/utility/quaternionFilters.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ static float GyroMeasError = PI * (40.0f / 180.0f);
3232
// the faster the solution converges, usually at the expense of accuracy.
3333
// In any case, this is the free parameter in the Madgwick filtering and
3434
// fusion scheme.
35-
static float beta = sqrt(3.0f / 4.0f) * GyroMeasError; // Compute beta
35+
static float gyro_beta = sqrt(3.0f / 4.0f) * GyroMeasError; // Compute beta
3636
// Compute zeta, the other free parameter in the Madgwick scheme usually
3737
// set to a small or zero value
3838
// 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,
120120
s4 *= norm;
121121

122122
// Compute rate of change of quaternion
123-
qDot1 = 0.5f * (-q2 * gx - q3 * gy - q4 * gz) - beta * s1;
124-
qDot2 = 0.5f * (q1 * gx + q3 * gz - q4 * gy) - beta * s2;
125-
qDot3 = 0.5f * (q1 * gy - q2 * gz + q4 * gx) - beta * s3;
126-
qDot4 = 0.5f * (q1 * gz + q2 * gy - q3 * gx) - beta * s4;
123+
qDot1 = 0.5f * (-q2 * gx - q3 * gy - q4 * gz) - gyro_beta * s1;
124+
qDot2 = 0.5f * (q1 * gx + q3 * gz - q4 * gy) - gyro_beta * s2;
125+
qDot3 = 0.5f * (q1 * gy - q2 * gz + q4 * gx) - gyro_beta * s3;
126+
qDot4 = 0.5f * (q1 * gz + q2 * gy - q3 * gx) - gyro_beta * s4;
127127

128128
// Integrate to yield quaternion
129129
q1 += qDot1 * deltat;

0 commit comments

Comments
 (0)
Failed to load comments.