From c0f106f49ed9d20d90000d7120cd21c02c4b9ba6 Mon Sep 17 00:00:00 2001 From: Laurent Eschenauer Date: Fri, 19 Jul 2013 09:12:07 +0200 Subject: [PATCH] Split EPS_LIN and EPS_ALT In order to have a different precision requirement on altitude than on horizontal positioning. --- lib/Controller.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/Controller.js b/lib/Controller.js index 7c7766e..0114241 100644 --- a/lib/Controller.js +++ b/lib/Controller.js @@ -5,9 +5,10 @@ var PID = require('./PID'); var EKF = require('./EKF'); var Camera = require('./Camera'); -EPS_LIN = 0.05; // We are ok with 5 cm precision -EPS_ANG = 0.05; // We are ok with 0.05 rad precision (2.5 deg) -STABLE_DELAY = 200; // Time in ms to wait before declaring the drone on target +EPS_LIN = 0.1; // We are ok with 10 cm horizontal precision +EPS_ALT = 0.1; // We are ok with 10 cm altitude precision +EPS_ANG = 0.1; // We are ok with 0.1 rad precision (5 deg) +STABLE_DELAY = 200; // Time in ms to wait before declaring the drone on target module.exports = Controller; util.inherits(Controller, EventEmitter); @@ -216,7 +217,7 @@ Controller.prototype.go = function(goal, callback) { // disable the controller, just in case. this.disable(); - // If no goal given, assume an empty goal (which means the current state as goal) + // If no goal given, assume an empty goal goal = goal || {}; // Normalize the yaw, to make sure we don't spin 360deg for @@ -295,7 +296,7 @@ Controller.prototype._control = function(d) { ; // Check if we are within the target area - if ((Math.abs(ex) < EPS_LIN) && (Math.abs(ey) < EPS_LIN) && (Math.abs(ez) < EPS_LIN) && (Math.abs(eyaw) < EPS_ANG)) { + if ((Math.abs(ex) < EPS_LIN) && (Math.abs(ey) < EPS_LIN) && (Math.abs(ez) < EPS_ALT) && (Math.abs(eyaw) < EPS_ANG)) { // Have we been here before ? if (!this._goal.reached && this._last_ok != 0) { // And for long enough ?