Iterated on square example; fixed Infinity issue
Esse commit está contido em:
@@ -68,28 +68,32 @@ async.waterfall([
|
|||||||
},
|
},
|
||||||
function(cb){
|
function(cb){
|
||||||
console.log("Going to base position");
|
console.log("Going to base position");
|
||||||
ctrl.go({x: 0, y: 0}, cb);
|
ctrl.go({x: 0, y:0, z: 1.5}, cb);
|
||||||
},
|
},
|
||||||
function(cb){
|
function(cb){
|
||||||
console.log("Going to 1");
|
console.log("Going to 1");
|
||||||
ctrl.go({x: 1, y: 0}, cb);
|
ctrl.go({x: 2, y: 0}, cb);
|
||||||
},
|
},
|
||||||
function(cb) {
|
function(cb) {
|
||||||
console.log("Going to 2");
|
console.log("Going to 2");
|
||||||
ctrl.go({x: 1, y: 1}, cb);
|
ctrl.go({x: 2, y: 2}, cb);
|
||||||
},
|
},
|
||||||
function(cb) {
|
function(cb) {
|
||||||
console.log("Going to 3");
|
console.log("Going to 3");
|
||||||
ctrl.go({x: 0, y: 1}, cb);
|
ctrl.go({x: 0, y: 2}, cb);
|
||||||
},
|
},
|
||||||
function(cb) {
|
function(cb) {
|
||||||
console.log("Going back to 0");
|
console.log("Going back to 0");
|
||||||
ctrl.go({x: 0, y: 0}, cb);
|
ctrl.go({x: 0, y: 0}, cb);
|
||||||
},
|
},
|
||||||
|
function(cb) {
|
||||||
|
console.log("Waiting 1 sec");
|
||||||
|
setTimeout(cb, 1000);
|
||||||
|
},
|
||||||
function(cb) {
|
function(cb) {
|
||||||
console.log("Landing...");
|
console.log("Landing...");
|
||||||
ctrl.disable();
|
ctrl.disable();
|
||||||
client.land();
|
client.land(cb);
|
||||||
}
|
}
|
||||||
], function (err, result) {
|
], function (err, result) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|||||||
+10
-9
@@ -23,9 +23,9 @@ function Controller(client, options) {
|
|||||||
this._tag = options.tag || {x: 0, y: 0, yaw: 0};
|
this._tag = options.tag || {x: 0, y: 0, yaw: 0};
|
||||||
|
|
||||||
// Configure the four PID required to control the drone
|
// Configure the four PID required to control the drone
|
||||||
this._pid_x = new PID(0.5, 0, 0.15);
|
this._pid_x = new PID(0.5, 0, 0.35);
|
||||||
this._pid_y = new PID(0.5, 0, 0.15);
|
this._pid_y = new PID(0.5, 0, 0.35);
|
||||||
this._pid_z = new PID(0.5, 0, 0.15);
|
this._pid_z = new PID(0.6, 0, 0.35);
|
||||||
this._pid_yaw = new PID(1.0, 0, 0.30);
|
this._pid_yaw = new PID(1.0, 0, 0.30);
|
||||||
|
|
||||||
// kalman filter is used for the drone state estimation
|
// kalman filter is used for the drone state estimation
|
||||||
@@ -226,12 +226,6 @@ Controller.prototype._control = function(d) {
|
|||||||
var cz = within(uz, -1, 1);
|
var cz = within(uz, -1, 1);
|
||||||
var cyaw = within(uyaw, -1, 1);
|
var cyaw = within(uyaw, -1, 1);
|
||||||
|
|
||||||
// Send commands to drone
|
|
||||||
this._client.front(cx);
|
|
||||||
this._client.right(cy);
|
|
||||||
this._client.up(cz);
|
|
||||||
this._client.clockwise(cyaw);
|
|
||||||
|
|
||||||
// Emit the control data for auditing
|
// Emit the control data for auditing
|
||||||
this.emit('controlData', {
|
this.emit('controlData', {
|
||||||
state: this._state,
|
state: this._state,
|
||||||
@@ -241,6 +235,13 @@ Controller.prototype._control = function(d) {
|
|||||||
last_ok: this._last_ok,
|
last_ok: this._last_ok,
|
||||||
tag: (d.visionDetect && d.visionDetect.nbDetected > 0) ? 1 : 0
|
tag: (d.visionDetect && d.visionDetect.nbDetected > 0) ? 1 : 0
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Send commands to drone
|
||||||
|
if (Math.abs(cx) > 0.01) this._client.front(cx);
|
||||||
|
if (Math.abs(cy) > 0.01) this._client.right(cy);
|
||||||
|
if (Math.abs(cz) > 0.01) this._client.up(cz);
|
||||||
|
if (Math.abs(cyaw) > 0.01) this._client.clockwise(cyaw);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function within(x, min, max) {
|
function within(x, min, max) {
|
||||||
|
|||||||
Referência em uma Nova Issue
Bloquear um usuário