Skip to content

Commit 78f7d09

Browse files
Use effient float (not double) trig functions
1 parent 870d772 commit 78f7d09

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 atan2(2 * q2 * q3 - 2 * q0 * q1, 2 * q0 * q0 + 2 * q3 * q3 - 1);};
41-
float getRoll(){return -1 * asin(2 * q1 * q3 + 2 * q0 * q2);};
42-
float getYaw(){return atan2(2 * q1 * q2 - 2 * q0 * q3, 2 * q0 * q0 + 2 * q1 * q1 - 1);};
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);};
4343
};
4444
#endif
4545

0 commit comments

Comments
 (0)