felixge / node-ar-drone

A node.js client for controlling Parrot AR Drone 2.0 quad-copters.
http://nodecopter.com/
MIT License
1.76k stars 428 forks source link

Get only selected data from navdata #95

Closed ibekmezci closed 10 years ago

ibekmezci commented 10 years ago

As I scanned the code, node-ar-drone can select a subset of navdata. In thşs way, the volume of the navdata can be smaller. However, I could not find any example about it. Can you provide an example about navdata selection. For example, what can we write if we want only gps and wind data?

wiseman commented 10 years ago

You use something like this to select which pieces of navdata you want:

var arDrone = require('ar-drone'); 
var arDroneConstants = require('ar-drone/lib/constants');

function navdataOptionMask(c) {
  return 1 << c;
}

var navdataOptions = (
    navdataOptionMask(arDroneConstants.options.DEMO)
  | navdataOptionMask(arDroneConstants.options.VISION_DETECT)
  | navdataOptionMask(arDroneConstants.options.MAGNETO)
  | navdataOptionMask(arDroneConstants.options.WIFI)
);

// Connect and configure the drone
var client = new arDrone.createClient();
client.config('general:navdata_demo', true);
client.config('general:navdata_options', navdataOptions);

The set of navdata options is defined at https://github.com/felixge/node-ar-drone/blob/6b08477a43667724b5b5c3bac7c15b7f013ec27f/lib/constants.js#L72

You might want WIND_SPEED and ZIMMU_3000 (which we think is GPS but see issue #75).