我需要来自AR Drone 2.0的实时GPS坐标,其中有飞行记录器。我无法找到任何方法直接从GPS获取值。有什么方法可以从AR Drone获取GPS数据
答案 0 :(得分:3)
这对我有用:
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()
};
其他帖子(https://github.com/felixge/node-ar-drone/issues/75)暗示这已经修复并合并,但情况绝对不是这样。