当我使用它时,我得到一个未定义的错误。纬度未定义。
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) {
console.log(navdata.gps.latitude + ', ' + navdata.gps.longitude);
// do stuff with the GPS information....
});
droneClient.takeoff(); .....
但是,如果我更改 1 行,我可以取回所有 gps 数据。
console.log(navdata.gps);
为什么我不能专门取回纬度数据?
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) {
console.log(navdata.gps);
// do stuff with the GPS information....
});
droneClient.takeoff(); .....