Arquivos
ardrone-webflight/plugins/blackbox/public/js/blackbox.js
T
Laurent Eschenauer 1c490dc610 Added blackbox plugin
Press 'r' in the cockpit to start/stop recording of
the mission data. Each recording has its own folder
and contains the raw navdata json and a formatted
motion stream in a csv file.

More data will be added (e.g.logging of events & commands)

Closes #7
2013-06-01 23:02:36 +02:00

43 linhas
1.1 KiB
JavaScript

(function(window, document) {
'use strict';
/*
* Constructuor
*/
var Blackbox = function Blackbox(cockpit) {
console.log("Loading Blackbox plugin.");
this.cockpit = cockpit;
this.recording = false;
// Register the various event handlers
this.listen();
};
/*
* Register keyboard event listener
*/
Blackbox.prototype.listen = function listen() {
var self = this;
$(document).keydown(function(ev) {
self.keyDown(ev);
});
};
/*
* Process onkeydown.
*/
Blackbox.prototype.keyDown = function keyDown(ev) {
if ([ev.keyCode] != 82) {
return;
}
ev.preventDefault();
this.recording = !this.recording;
var cmd = this.recording ? "stop" : "start";
this.cockpit.socket.emit("/blackbox/" + cmd, {});
};
window.Cockpit.plugins.push(Blackbox);
}(window, document));