Skip to content

Commit

Permalink
Updated GPS navdata definition for firmware version 2.4.8.
Browse files Browse the repository at this point in the history
I also took this opportunity to rename GPS data fields to be
consistent with existing nomenclature (that is, degreeMag instead of
degree_mag).

The new data definitions come from
AutonomyLab/ardrone_autonomy#95 which
supposedly came via backchannels from Parrot.

I spliced a GPS navdata option collected from a drone running 2.4.8
into test/fixtures/navdata.bin and updated the unit tests.
  • Loading branch information
John Wiseman committed May 8, 2014
1 parent e0e3144 commit f1b48cd
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 58 deletions.
56 changes: 28 additions & 28 deletions lib/navdata/parseNavdata.js
Original file line number Diff line number Diff line change
Expand Up @@ -545,45 +545,45 @@ exports.OPTION_PARSERS = {

'gps': function(reader) {
return {
// from https://github.com/paparazzi/paparazzi/blob/55e3d9d79119f81ed0b11a59487280becf13cf40/sw/airborne/boards/ardrone/at_com.h#L157
// from https://github.com/lesire/ardrone_autonomy/commit/a986b3380da8d9306407e2ebfe7e0f2cd5f97683
latitude: reader.double64(),
longitude: reader.double64(),
elevation: reader.double64(),
hdop: reader.double64(),
data_available: reader.int32(),
unk_0: timesMap(8, reader.uint8, reader),
dataAvailable: reader.int32(),
zeroValidated: reader.int32(),
wptValidated: reader.int32(),
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),
latFuse: reader.double64(),
lonFuse: reader.double64(),
gpsState: reader.uint32(),
xTraj: reader.float32(),
xRef: reader.float32(),
yTraj: reader.float32(),
yRef: reader.float32(),
thetaP: reader.float32(),
phiP: reader.float32(),
thetaI: reader.float32(),
phiI: reader.float32(),
thetaD: reader.float32(),
phiD: reader.float32(),
vdop: reader.double64(),
pdop: reader.double64(),
speed: reader.float32(),
last_frame_timestamp: droneTimeToMilliSeconds(reader.uint32()),
lastFrameTimestamp: droneTimeToMilliSeconds(reader.uint32()),
degree: reader.float32(),
degree_mag: reader.float32(),
unk_2: timesMap(16, reader.uint8, reader),
degreeMag: reader.float32(),
ehpe: reader.float32(),
ehve: reader.float32(),
c_n0: reader.float32(),
nbSatellites: reader.uint32(),
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()
gpsPlugged: reader.int32(),
ephemerisStatus: reader.uint32(),
vxTraj: reader.float32(),
vyTraj: reader.float32(),
firmwareStatus: reader.uint32()
};
}
};
Expand Down
Binary file modified test/fixtures/navdata.bin
Binary file not shown.
76 changes: 46 additions & 30 deletions test/unit/navdata/test-parseNavdata.js
Original file line number Diff line number Diff line change
Expand Up @@ -788,39 +788,55 @@ test('parseNavdata', {

'parses gps option': function() {
var gps = parseNavdata(fixture).gps;
assert.equal(gps.latitude, 34.0903478);
// assert.equal(gps.longitude, 0);
assert.equal(gps.elevation, 130.39);
//assert.equal(gps.hdop, 0);
assert.equal(gps.lat0, 34.090359093568644);
assert.equal(gps.lon0, -118.276604);
assert.equal(gps.lat_fuse, 34.09035909403431);
assert.equal(gps.lon_fuse, -118.276604);
//assert.equal(gps.vdop, 0);
assert.equal(gps.latitude, 34.0905016);
assert.equal(gps.longitude, -118.2766877);
assert.equal(gps.elevation, 122.64);
assert.equal(gps.hdop, 1);
assert.equal(gps.dataAvailable, 7);
assert.equal(gps.zeroValidated, 1);
assert.equal(gps.wptValidated, 0);
assert.equal(gps.lat0, 34.0905016);
assert.equal(gps.lon0, -118.2766877);
assert.equal(gps.latFuse, 34.0904833);
assert.equal(gps.lonFuse, -118.2766982);
assert.equal(gps.gpsState, 1);
assert.equal(gps.xTraj, 0);
assert.equal(gps.xRef, 0);
assert.equal(gps.yTraj, 0);
assert.equal(gps.yRef, 0);
assert.equal(gps.thetaP, 0);
assert.equal(gps.phiP, 0);
assert.equal(gps.thetaD, 0);
assert.equal(gps.phiD, 0);
assert.equal(gps.vdop, 0);
assert.equal(gps.pdop, 0);
assert.equal(gps.speed, 0.4399999976158142);
assert.equal(gps.last_frame_timestamp, 1816647.945);
assert.equal(gps.degree, 170.16000366210938);
assert.equal(gps.degree_mag, 0);
assert.equal(gps.speed, 0.10000000149011612);
assert.equal(gps.lastFrameTimestamp, 2409.591);
assert.equal(gps.degree, 141.00999450683594);
assert.equal(gps.degreeMag, 0);
assert.equal(gps.ehpe, 8.260000228881836);
assert.equal(gps.ehve, 0.429999977350235);
assert.equal(gps.c_n0, 28);
assert.equal(gps.nbSatellites, 9);
assert.deepEqual(
gps.channels,
[{sat: 22, cn0: 36},
{sat: 15, cn0: 17},
{sat: 11, cn0: 227},
{sat: 11, cn0: 227},
{sat: 18, cn0: 27},
{sat: 29, cn0: 16},
{sat: 21, cn0: 22},
{sat: 16, cn0: 0},
{sat: 27, cn0: 0},
{sat: 30, cn0: 0},
{sat: 12, cn0: 227},
{sat: 12, cn0: 227}]);
assert.equal(gps.gps_plugged, 1);
assert.equal(gps.gps_time, 0);
assert.equal(gps.week, 0);
assert.equal(gps.gps_fix, 0);
assert.equal(gps.num_satellites, 0);
[ { sat: 10, cn0: 26 },
{ sat: 5, cn0: 21 },
{ sat: 8, cn0: 27 },
{ sat: 3, cn0: 17 },
{ sat: 13, cn0: 18 },
{ sat: 7, cn0: 32 },
{ sat: 9, cn0: 23 },
{ sat: 27, cn0: 9 },
{ sat: 19, cn0: 19 },
{ sat: 28, cn0: 29 },
{ sat: 30, cn0: 26 },
{ sat: 138, cn0: 0 } ]);
assert.equal(gps.gpsPlugged, 1);
assert.equal(gps.ephemerisStatus, 73);
assert.equal(gps.vxTraj, 0);
assert.equal(gps.vyTraj, 0);
assert.equal(gps.firmwareStatus, 1);
},

'throws exception on invalid header': function() {
Expand Down

0 comments on commit f1b48cd

Please sign in to comment.