Split EPS_LIN and EPS_ALT

In order to have a different precision requirement
on altitude than on horizontal positioning.
Esse commit está contido em:
Laurent Eschenauer
2013-07-19 09:12:07 +02:00
commit c0f106f49e
+6 -5
Ver Arquivo
@@ -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 ?