Be coherent, yaw always expressed in degrees in the API
Esse commit está contido em:
+16
-8
@@ -97,7 +97,7 @@ Controller.prototype.state = function() {
|
||||
* Sets the goal to the current state and attempt to hover on top.
|
||||
*/
|
||||
Controller.prototype.hover = function() {
|
||||
this.go({x: this._state.x, y: this._state.y, z: this._state.z, yaw: this._state.yaw});
|
||||
this._go({x: this._state.x, y: this._state.y, z: this._state.z, yaw: this._state.yaw});
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -125,7 +125,7 @@ Controller.prototype.forward = function(distance, callback) {
|
||||
var gy = state.y + Math.sin(state.yaw) * distance;
|
||||
|
||||
// Assign the new goal
|
||||
this.go({x: gx, y: gy, z: state.z, yaw: state.yaw}, callback);
|
||||
this._go({x: gx, y: gy, z: state.z, yaw: state.yaw}, callback);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -148,7 +148,7 @@ Controller.prototype.right = function(distance, callback) {
|
||||
var gy = state.y + Math.cos(state.yaw) * distance;
|
||||
|
||||
// Assign the new goal
|
||||
this.go({x: gx, y: gy, z: state.z, yaw: state.yaw}, callback);
|
||||
this._go({x: gx, y: gy, z: state.z, yaw: state.yaw}, callback);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -167,7 +167,7 @@ Controller.prototype.cw = function(angle, callback) {
|
||||
var state = this.state();
|
||||
var yaw = state.yaw.toDeg() + angle;
|
||||
|
||||
return this.go({x: state.x, y: state.y, z: state.z, yaw: yaw.toRad()}, callback);
|
||||
return this._go({x: state.x, y: state.y, z: state.z, yaw: yaw.toRad()}, callback);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -182,7 +182,7 @@ Controller.prototype.ccw = function(angle, callback) {
|
||||
*/
|
||||
Controller.prototype.up = function(distance, callback) {
|
||||
var state = this.state();
|
||||
return this.go({x: state.x, y: state.y, z: state.z + distance, yaw: state.yaw}, callback);
|
||||
return this._go({x: state.x, y: state.y, z: state.z + distance, yaw: state.yaw}, callback);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -197,7 +197,7 @@ Controller.prototype.down = function(distance, callback) {
|
||||
*/
|
||||
Controller.prototype.altitude = function(altitude, callback) {
|
||||
var state = this.state();
|
||||
return this.go({x: state.x, y: state.y, z: altitude, yaw: state.yaw}, callback);
|
||||
return this._go({x: state.x, y: state.y, z: altitude, yaw: state.yaw}, callback);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -205,7 +205,7 @@ Controller.prototype.altitude = function(altitude, callback) {
|
||||
*/
|
||||
Controller.prototype.yaw = function(yaw, callback) {
|
||||
var state = this.state();
|
||||
return this.go({x: state.x, y: state.y, z: state.z, yaw: yaw.toRad()}, callback);
|
||||
return this._go({x: state.x, y: state.y, z: state.z, yaw: yaw.toRad()}, callback);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -213,9 +213,17 @@ Controller.prototype.yaw = function(yaw, callback) {
|
||||
* is reached, the callback is called with the current state.
|
||||
*
|
||||
* x,y,z in meters
|
||||
* yaw in radians
|
||||
* yaw in degrees
|
||||
*/
|
||||
Controller.prototype.go = function(goal, callback) {
|
||||
if (goal.yaw != undefined) {
|
||||
goal.yaw = goal.yaw.toRad();
|
||||
}
|
||||
|
||||
return this._go(goal);
|
||||
}
|
||||
|
||||
Controller.prototype._go = function(goal, callback) {
|
||||
// Since we are going to modify goal settings, we
|
||||
// disable the controller, just in case.
|
||||
this.disable();
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário