diff --git a/lib/Controller.js b/lib/Controller.js index 5e808b7..e16e1bd 100644 --- a/lib/Controller.js +++ b/lib/Controller.js @@ -299,8 +299,8 @@ Controller.prototype._control = function(d) { ; // Normalize eyaw within [-180, 180] - while(eyaw < Math.PI/2) eyaw += Math.PI; - while(eyaw >= Math.PI/2) eyaw -= Math.PI; + while(eyaw < -Math.PI) eyaw += (2 * Math.PI); + while(eyaw > Math.PI) eyaw -= (2 * Math.PI); // Check if we are within the target area if ((Math.abs(ex) < EPS_LIN) && (Math.abs(ey) < EPS_LIN) && (Math.abs(ez) < EPS_ALT) && (Math.abs(eyaw) < EPS_ANG)) {