Skip to content

Commit bcbb6fb

Browse files
Proper float constants
1 parent 78f7d09 commit bcbb6fb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/MadgwickAHRS.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ class Madgwick{
3737
Madgwick(void);
3838
void update(float gx, float gy, float gz, float ax, float ay, float az, float mx, float my, float mz);
3939
void updateIMU(float gx, float gy, float gz, float ax, float ay, float az);
40-
float getPitch(){return atan2f(2 * q2 * q3 - 2 * q0 * q1, 2 * q0 * q0 + 2 * q3 * q3 - 1);};
41-
float getRoll(){return -1 * asinf(2 * q1 * q3 + 2 * q0 * q2);};
42-
float getYaw(){return atan2f(2 * q1 * q2 - 2 * q0 * q3, 2 * q0 * q0 + 2 * q1 * q1 - 1);};
40+
float getPitch(){return atan2f(2.0f * q2 * q3 - 2.0f * q0 * q1, 2.0f * q0 * q0 + 2.0f * q3 * q3 - 1.0f);};
41+
float getRoll(){return -1.0f * asinf(2.0f * q1 * q3 + 2.0f * q0 * q2);};
42+
float getYaw(){return atan2f(2.0f * q1 * q2 - 2.0f * q0 * q3, 2.0f * q0 * q0 + 2.0f * q1 * q1 - 1.0f);};
4343
};
4444
#endif
4545

0 commit comments

Comments
 (0)