其他帖子(https://github.com/felixge/node-ar-drone/issues/75)暗示这已经被修复和合并,但事实并非如此。
我需要AR无人机2.0的实时GPS坐标,其中有飞行记录器。我找不到任何方法直接从GPS获取值。有没有办法我可以从AR无人机获得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.latitude + ', ' + navdata.gps.longitude);
// do stuff with the GPS information....
});
droneClient.takeoff(); .....
这个代码单独没有给我GPS信息。我还不得不注释掉部分parseNavdata.js(在ar-drone/lib/navdata)代码。在我的文件中查找:"'gps': function(reader){" ~第546行。注释掉函数的下半部分:
'gps': function(reader) {
return {
latitude: reader.double64(),
longitude: reader.double64(),
elevation: reader.double64(),
hdop: reader.double64(),
data_available: reader.int32(),
unk_0: timesMap(8, reader.uint8, reader),
lat0: reader.double64(),
lon0: reader.double64(),
lat_fuse: reader.double64(),
lon_fuse: reader.double64(),
gps_state: reader.uint32(),
unk_1: timesMap(40, reader.uint8, reader),
vdop: reader.double64(),
pdop: reader.double64(),
speed: reader.float32(),
last_frame_timestamp: droneTimeToMilliSeconds(reader.uint32()),
degree: reader.float32(),
degree_mag: reader.float32()
// unk_2: timesMap(16, reader.uint8, reader),
// channels: timesMap(12, reader.satChannel, reader),
// gps_plugged: reader.int32(),
// unk_3: timesMap(108, reader.uint8, reader),
// gps_time: reader.double64(),
// week: reader.uint16(),
// gps_fix: reader.uint8(),
// num_satellites: reader.uint8(),
// unk_4: timesMap(24, reader.uint8, reader),
// ned_vel_c0: reader.double64(),
// ned_vel_c1: reader.double64(),
// ned_vel_c2: reader.double64(),
// pos_accur_c0: reader.double64(),
// pos_accur_c1: reader.double64(),
// pos_accur_c2: reader.double64(),
// speed_accur: reader.float32(),
// time_accur: reader.float32(),
// unk_5: timesMap(72, reader.uint8, reader),
// temperature: reader.float32(),
// pressure: reader.float32()
};