Node Ar-drone and navistick le

5 views
Skip to first unread message

Stech

unread,
Aug 22, 2014, 8:06:14 PM8/22/14
to node-a...@googlegroups.com
I've built a pretty simple node-ardrone program with the following code.  I modified a navistick LE GPS to work with the drone and it seems to be finding and sending GPS data, however the node-ardrone program doesn't always grab it.

A.) Very basic node otpions

*******
//ARDRONE node snippet.
var arDrone = require('ar-drone');
var arDroneConstants = require('ar-drone/lib/constants')
var client  = arDrone.createClient();
console.log(">> Connected.  Waiting for NAV Data <<<");
var handleNavData = function(data){

navCounter++;polPrint('TEST');
if(navCounter==100){
console.log(data);
navCounter=0;
}
}

//Setup data: 

   //Enable the magnetometer data.
function navdata_option_mask(c) {
 return 1 << c;
}
var navdataOptions = (
   navdata_option_mask(arDroneConstants.options.VISION_DETECT)
  | navdata_option_mask(arDroneConstants.options.MAGNETO)
  | navdata_option_mask(arDroneConstants.options.WIFI)
  | navdata_option_mask(arDroneConstants.options.WIND_SPEED) 
  | navdata_option_mask(arDroneConstants.options.ALTITUDE) 
  |navdata_option_mask(arDroneConstants.options.ZIMMU_3000)
);
client.config('general:navdata_options', navdataOptions);
client.on('navdata', handleNavData);


*********

From the output console.log (on navdata) I get:
{ header: 1432778632,
  droneState:
   { flying: 0,
     videoEnabled: 0,
     visionEnabled: 0,
     controlAlgorithm: 0,
     altitudeControlAlgorithm: 1,
     startButtonState: 0,
     controlCommandAck: 0,
     cameraReady: 1,
     travellingEnabled: 0,
     usbReady: 0,
     navdataDemo: 1,
     navdataBootstrap: 1,
     motorProblem: 0,
     communicationLost: 0,
     softwareFault: 0,
     lowBattery: 0,
     userEmergencyLanding: 0,
     timerElapsed: 0,
     MagnometerNeedsCalibration: 1,
     anglesOutOfRange: 0,
     tooMuchWind: 0,
     ultrasonicSensorDeaf: 0,
     cutoutDetected: 0,
     picVersionNumberOk: 1,
     atCodecThreadOn: 1,
     navdataThreadOn: 1,
     videoThreadOn: 1,
     acquisitionThreadOn: 1,
     controlWatchdogDelay: 0,
     adcWatchdogDelay: 0,
     comWatchdogProblem: 0,
     emergencyLanding: 0 },
  sequenceNumber: 4193,
  visionFlag: 0 }

b.) When I close and re-run the code (same instructions executed), I finally start getting the data I requested the
gps:
 { latitude: 0,
   longitude: 0,
   elevation: 0,
   hdop: 0,
   dataAvailable: 0,
   zeroValidated: 0,
   wptValidated: 0,
   lat0: 0,
   lon0: 0,
   latFuse: 0,
   lonFuse: 0,
   gpsState: 0,
   xTraj: 0,
   xRef: 0,
   yTraj: 0,
   yRef: 0,
   thetaP: 0,
   phiP: 0,
   thetaI: 0,
   phiI: 0,
   thetaD: 0,
   phiD: 0,
   vdop: 0,
   pdop: 0,
   speed: 0,
   lastFrameTimestamp: 673.004,
   degree: 0,
   degreeMag: 0,
   ehpe: 0,
   ehve: 0,
   c_n0: 26,
   nbSatellites: 0,
   channels:
    [ [Object],
      [Object],
      [Object],
      [Object],
      [Object],
      [Object],
      [Object],
      [Object],
      [Object],
      [Object],
      [Object],
      [Object] ],
   gpsPlugged: 1,
   ephemerisStatus: 0,
   vxTraj: 0,
   vyTraj: 0,
   firmwareStatus: 0 } }

c.) So at this point, from the GPS, I am only getting the c_n0 data being returned.  
I console.log the gps data in parseNavdata.js and get this (not sure if its helpful):
{ domain: null,
  _events: {},
  _maxListeners: 1
  writable: true,
  _buffer: <Buffer
 00 00 00 00 00 00
  _compact: false,
  _paused: false,
  _offset: 0 }
d.) Time to check the drone...telnet in:
/bin/sh /bin/program.elf.respawner.sh -360p.slices 0 -live.tcp -gps.verbose -gps.log &
killall -9 program.elf.respawner.sh <--- needed since FW 2.4.7
killall -9 program.elf

e.) /data/gps.log is still empty, but the syslog.bin is showing data.  We still get no data in ardrone code.
f.) After killing/renabling the program a few times, eventually we start getting data from the GPS verbosely printed:
................
n0max 0 : 1 34
 cn0max 1 : 0 28
 Average C/N0 (2 sat.) : 31
<[A0][A2][00][5B][29=41d][00][01][00][00][07][0E][1E][57][79][74][07][DE][08][16][15][17][CF][D4][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][15][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][03][9A][53][7C][00][00][00][00][00][1B][F2][99][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][07][9A][B0][B3]>
<[A0][A2][00][BC][04=04d][03][0E][03][08][BF][58][0C][05][88][5B][00][BF][1C][1C][1C][1C][1C][1C][1C][1C][1B][1B][06][10][5C][00][BF][22][22][21][21][21][21][21][21][21][21][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][06][7D][B0][B3]>
 cn0max 0 : 1 34
 cn0max 1 : 0 28
 Average C/N0 (2 sat.) : 31
<[A0][A2][00][5B][29=41d][00][01][00][00][07][0E][1E][57][7D][5C][07][DE][08][16][15][17][D3][BC][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][15][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][03][B6][46][74][00][00][00][00][00][1B][F2][99][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][07][79][B0][B3]>
<[A0][A2][00][BC][04=04d][03][0E][03][08][BF][BC][0C][05][88][5B][00][BF][1C][1C][1C][1C][1C][1C][1C][1B][1B][1B][06][10][5C][00][BF][22][22][21][21][21][21][21][21][21][21][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][06][E0][B0][B3]>
 cn0max 0 : 1 34
 cn0max 1 : 0 28
 Average C/N0 (2 sat.) : 31
<[A0][A2][00][5B][29=41d][00][01][00][00][07][0E][1E][57][81][44][07][DE][08][16][15][17][D7][A4][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][15][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][03][D2][39][8A][00][00][00][00][00][1B][F2][99][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][07][76][B0][B3]>
<[A0][A2][00][BC][04=04d][03][0E][03][08][C0][20][0C][05][88][5B][00][BF][1C][1C][1C][1C][1C][1C][1C][1B][1B][1B][06][10][5C][00][BF][22][22][21][21][21][21][21][21][21][21][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][06][45][B0][B3]>
 cn0max 0 : 1 34
 cn0max 1 : 0 28
 Average C/N0 (2 sat.) : 31
<[A0][A2][00][5B][29=41d][00][01][00][00][07][0E][1E][57][85][2C][07][DE][08][16][15][17][DB][8C][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][15][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][03][EE][2C][82][00][00][00][00][00][1B][F2][99][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][07][55][B0][B3]>
<[A0][A2][00][BC][04=04d][03][0E][03][08][C0][84][0C][05][88][5B][00][BF][1C][1C][1C][1C][1C][1C][1B][1B][1B][1B][06][10][5C][00][BF][22][22][21][21][21][21][21][21][21][21][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][06][A8][B0][B3]>
 cn0max o1 34
 cn0max 1 : 0 28
 Average C/N0 (2 sat.) : 31
.........

So it looks like its getting 2 sats (indoors) and getting the data.  The ARDRONE GPS data only ever shows the 

lastFrameTimestamp: 233.122,
and
c_n0: 26 (which matches what I see as the "Average C/N0 (2 sat.): 26.



So Node-ardrone is getting a few of the fields and we are getting some data from GPS.

I am using the latest version of AR-DRONE from git as well.

What would cause it to do this?  Even without restarting the elf code on the drone (fresh reboot), I get the C_n0 data but usually nothing else.
Every once in a blue moon the planets and stars align and I get the GPS data filled out in the node code and it works perfectly.

Can anyone give me any tips as to what to try next to debug this thing?  When I get the "bluemoon" scenario, the navistick works great and is really light.  With the blue-moon there is also no pattern.  Sometimes it happens with just turning it on.  Other times, it works by unplugging/replugging it in.  The majority of the time I just experience the issue I described above and never get any data other than the C_n0 data field.  Any help would really be appreciated.  There has to be some kind of switch I should be using to get the GPS data.
Message has been deleted

Stech

unread,
Aug 23, 2014, 9:08:27 AM8/23/14
to node-a...@googlegroups.com
I ended up solving the issue, by taking a few steps back.  I downloaded the master ar-drone library and replaced the existing one. 

I then used the following navDataOptions config to get exactly what I needed.  The drone gods smiled upon me and my gps data returned (validated lat/lon points to be sure). I suspect it was a corrupt file in the ar-drone library.

var navdataOptions = (
   navdata_option_mask(arDroneConstants.options.DEMO)
  | navdata_option_mask(arDroneConstants.options.VISION_DETECT)
  | navdata_option_mask(arDroneConstants.options.MAGNETO)
  | navdata_option_mask(arDroneConstants.options.WIFI)
  | navdata_option_mask(arDroneConstants.options.WIND_SPEED) 
  |navdata_option_mask(arDroneConstants.options.ALTITUDE) 
  |navdata_option_mask(arDroneConstants.options.ZIMMU_3000)
 // |navdata_option_mask(arDroneConstants.options.ZIMMU_3000)
  
);
client.config('general:navdata_demo', true);
Reply all
Reply to author
Forward
0 new messages