ardupilot icon indicating copy to clipboard operation
ardupilot copied to clipboard

Update Trig

Open jason4short opened this issue 13 years ago • 1 comments

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.

jason4short avatar Apr 02 '13 05:04 jason4short

corrected in master here: https://github.com/diydrones/ardupilot/commit/3bf847f675ce94492b1a431496afeaa1d0728144

Thanks!

rmackay9 avatar Apr 02 '13 06:04 rmackay9