ardupilot
ardupilot copied to clipboard
Update Trig
These values for yaw are calculated twice:
OK: sin_yaw_y = yawvector.x; // 1y = north cos_yaw_x = yawvector.y; // 0x = north
Recently added: sin_yaw = constrain(temp.b.x/cos_pitch_x, -1.0, 1.0); cos_yaw = constrain(temp.a.x/cos_pitch_x, -1.0, 1.0);
consider instead: sin_yaw = constrain(yawvector.y, -1.0, 1.0); cos_yaw = constrain(yawvector.x, -1.0, 1.0);
This would remove two redundant float divisions.
corrected in master here: https://github.com/diydrones/ardupilot/commit/3bf847f675ce94492b1a431496afeaa1d0728144
Thanks!