Arquivos
ardrone-webflight/plugins/pilot/index.js
T
John Wiseman 7e20174c38 Added magnetometer calibration to pilot plugin.
Also pass some events through the websocket.
2013-05-28 18:41:56 -07:00

21 linhas
754 B
JavaScript

function pilot(name, deps) {
deps.io.sockets.on('connection', function (socket) {
socket.on('/pilot/move', function (cmd) {
var _name;
console.log("move", cmd);
return typeof deps.client[_name = cmd.action] === "function" ? deps.client[_name](cmd.speed) : void 0;
});
socket.on('/pilot/drone', function (cmd) {
var _name;
console.log("drone", cmd);
return typeof deps.client[_name = cmd.action] === "function" ? deps.client[_name]() : void 0;
});
socket.on('/pilot/calibrate', function (cmd) {
console.log("calibrate", cmd);
return deps.client.calibrate(cmd.device_num);
});
});
};
module.exports = pilot;