zero() reset the kalman filter

Esse commit está contido em:
Laurent Eschenauer
2013-06-26 14:20:59 +02:00
commit af5882cc16
2 arquivos alterados com 18 adições e 0 exclusões
+10
Ver Arquivo
@@ -99,6 +99,16 @@ Controller.prototype.hover = function() {
this.go({x: this._state.x, y: this._state.y, z: this._state.z, yaw: this._state.yaw});
}
/*
* Reset the kalman filter to its base state (default is x:0, y:0, yaw:0).
*
* This is especially usefull to set mark the drone position as the starting position
* after takeoff.
*/
Controller.prototype.zero = function() {
this._ekf.reset();
}
/*
* Move forward (direction faced by the front camera) by the given
* distance (in meters).
+8
Ver Arquivo
@@ -107,5 +107,13 @@ test('Controller', {
ctrl.left(1, cb);
assert(ctrl.right.calledWith(-1, cb));
},
'zero reset the kalman filter': function() {
var ctrl = new autonomy.Controller(this.mockClient);
sinon.spy(ctrl._ekf, 'reset');
ctrl.zero();
assert(ctrl._ekf.reset.calledOnce);
}
});