From 35ffd5548126a356fa7084ca1e964f3da9b2897f Mon Sep 17 00:00:00 2001 From: Paul Riseborough Date: Mon, 7 Aug 2017 10:34:19 +1000 Subject: [PATCH] EKF: Fix incorrect use of double precision operation --- EKF/mag_fusion.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/EKF/mag_fusion.cpp b/EKF/mag_fusion.cpp index 00780c4300..6c19d63950 100644 --- a/EKF/mag_fusion.cpp +++ b/EKF/mag_fusion.cpp @@ -537,12 +537,12 @@ void Ekf::fuseHeading() // Calculate the body to earth frame rotation matrix from the euler angles using a 312 rotation sequence // Equations from Tbn_312.c produced by https://github.com/PX4/ecl/blob/master/matlab/scripts/Inertial%20Nav%20EKF/quat2yaw312.m Dcmf R_to_earth; - float sy = sin(yaw); - float cy = cos(yaw); - float sp = sin(pitch); - float cp = cos(pitch); - float sr = sin(roll); - float cr = cos(roll); + float sy = sinf(yaw); + float cy = cosf(yaw); + float sp = sinf(pitch); + float cp = cosf(pitch); + float sr = sinf(roll); + float cr = cosf(roll); R_to_earth(0,0) = cy*cp-sy*sp*sr; R_to_earth(0,1) = -sy*cr; R_to_earth(0,2) = cy*sp+sy*cp*sr;