Skip to content

Commit

Permalink
Improved logging output and clarity for the simulator.
Browse files Browse the repository at this point in the history
  • Loading branch information
Remy Porter committed Jun 30, 2015
1 parent a4482bd commit ec45391
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 0 additions & 2 deletions drone-osc.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ function DroneControl(drone) {
self.drone.config("control:altitude_max", 5000);
this.register = function(address, callback) {
var parsed = parsePath(address);
console.log(parsed.message);
self[parsed.message] = function(address, data) {
var sliced = data.slice(1);
callback(self.drone, address, sliced);
Expand Down Expand Up @@ -136,7 +135,6 @@ dc.register(path("id", "/move/") + "zero", function(drone, address, data) {
srv.on("message", function(msg, rinfo) {
var address = msg[0];
var parsed = parsePath(address).message;
console.log(parsed);
var resolved = dc[parsed];
resolved.call(dc, parsed, msg);
});
12 changes: 10 additions & 2 deletions drone-sim.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,24 @@ function DroneSim() {
self.vector = [0,0,0,0];
self.flying = false;
var x = 0, y = 1, z = 2, t = 3;
function op(name) {
console.log(name, self.vector, self.flying);
}
self.config = function() {
console.log("Configed: ", arguments);
}
self.stop = function() {
self.vector = [0,0,0, 0];
self.vector = [0,0,0,0];
op("stop");
}
self.land = function() {
self.stop();
self.flying = false;
op("land");
}
self.takeoff = function() {
self.flying = true;
op("takeoff");
}
self.disableEmergency = function() {
return true;
Expand All @@ -31,7 +37,8 @@ function DroneSim() {
["front", z, 1], ["back", t, -1]
].forEach(function(dirVec) {
self[dirVec[0]] =
direction(dirVec[1], dirVec[2])
direction(dirVec[1], dirVec[2]) ;
op(dirVec[0]);
});

self.animate = function(animation, duration) {
Expand All @@ -43,6 +50,7 @@ function DroneSim() {
}

self.reset = function() {
op("reset");
self.land();
}
}

0 comments on commit ec45391

Please sign in to comment.