From c3660728df8096f8a37790e24aeba7207808c67f Mon Sep 17 00:00:00 2001 From: Brian Lambert Date: Fri, 17 Jun 2016 06:57:48 -0400 Subject: [PATCH] Raw. --- MadgwickAHRS/CoreMotionMadgwickTestDriver.m | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/MadgwickAHRS/CoreMotionMadgwickTestDriver.m b/MadgwickAHRS/CoreMotionMadgwickTestDriver.m index a427718..62ad0d6 100644 --- a/MadgwickAHRS/CoreMotionMadgwickTestDriver.m +++ b/MadgwickAHRS/CoreMotionMadgwickTestDriver.m @@ -12,16 +12,10 @@ #import "CoreMotionMadgwickTestDriver.h" #import "MadgwickSensorFusion.h" -// Normalizes. -float NormalizeAngle(float angle) -{ - return fmodf(angle + 360.0f, 360.0f); -} - // Converts radians to degrees. static inline float RadiansToDegrees(float radians) { - return radians * 180.0f / M_PI; + return radians * 180.0f / (float)M_PI; } // Calculates Euler angles from quaternion. @@ -111,9 +105,9 @@ - (void)start [_madgwickSensorFusion updateWithGyroscopeX:(float)[motion rotationRate].x gyroscopeY:(float)[motion rotationRate].y gyroscopeZ:(float)[motion rotationRate].z - accelerometerX:(float)[motion gravity].x * -1.0f - accelerometerY:(float)[motion gravity].y * -1.0f - accelerometerZ:(float)[motion gravity].z * -1.0f + accelerometerX:(float)[motion gravity].x + accelerometerY:(float)[motion gravity].y + accelerometerZ:(float)[motion gravity].z magnetometerX:(float)[motion magneticField].field.x magnetometerY:(float)[motion magneticField].field.y magnetometerZ:(float)[motion magneticField].field.z]; @@ -127,9 +121,9 @@ - (void)start &roll, &pitch, &yaw); - roll = NormalizeAngle(RadiansToDegrees(roll)); + roll = RadiansToDegrees(roll); pitch = RadiansToDegrees(pitch); - yaw = NormalizeAngle(RadiansToDegrees(yaw)); + yaw = RadiansToDegrees(yaw); // Obtain CoreMotion roll, pitch and yaw for comparison logging below. float coreMotionRoll = RadiansToDegrees([[motion attitude] roll]);