Saturday, 8 April 2017

ar-drone Cannot read property 'latitude' of undefined intermittent data

When I use this code I see error messages, then gps data then back to error messages. Can anyone tell me why this happens?

var arDrone = require('ar-drone');
var droneClient = arDrone.createClient();
droneClient.config('general:navdata_demo', 'FALSE'); // get back all data the copter can send
droneClient.config('general:navdata_options', 777060865); // turn on GPS

droneClient.on('navdata', function(navdata) {

  try {
    console.log(navdata.gps.latitude + ', ' + navdata.gps.longitude);
}
catch(err) {
    console.log(err.message);
}


});

Here is what I see when I execute this. It seems the gps data never comes back.

Cannot read property 'latitude' of undefined 43.6330829, -116.4467156 43.6330829, -116.4467156 43.6330829, -116.4467156 43.6330829, -116.4467156 43.6330829, -116.4467156 43.6330829, -116.4467156 43.6330829, -116.4467156 43.6330829, -116.4467156 43.6330829, -116.4467156 43.6330829, -116.4467156 43.6330829, -116.4467156 43.6330829, -116.4467156 43.6330829, -116.4467156 43.6330829, -116.4467156 43.6330829, -116.4467156 43.6330829, -116.4467156 43.6330829, -116.4467156 43.6330829, -116.4467156 43.6330829, -116.4467156 43.6330829, -116.4467156 Cannot read property 'latitude' of undefined Cannot read property 'latitude' of undefined Cannot read property 'latitude' of undefined Cannot read property 'latitude' of undefined Cannot read property 'latitude' of undefined Cannot read property 'latitude' of undefined Cannot read property 'latitude' of undefined Cannot read property 'latitude' of undefined Cannot read property 'latitude' of undefined Cannot read property 'latitude' of undefined Cannot read property 'latitude' of undefined Cannot read property 'latitude' of undefined Cannot read property 'latitude' of undefined Cannot read property 'latitude' of undefined Cannot read property 'latitude' of undefined Cannot read property 'latitude' of undefined Cannot read property 'latitude' of undefined Cannot read property 'latitude' of undefined Cannot read property 'latitude' of undefined



via Kevin Hunkovic

No comments:

Post a Comment