Parsing GPS data on ardupilot

Since good GPS modules are expensive and phones have a lot of positioning systems build in I decided to try and use an android smartphone as a GPS source for the APM. I have successfully made an app that connects to a usb to serial converter and sends the position data in NMEA format. When I connect this contraption to u-center it successfully gets a 3D fix with DOP lower than 1 in less than 15 seconds. However, when I connect this to the APM it says no GPS. Here are examples of how the original GPS sends data:

  • ??:??:?? $GPTXT,01,01,02,u-blox ag - www.u-blox.com*50
  • ??:??:?? $GPTXT,01,01,02,HW UBX-G70xx 00070000 *77
  • ??:??:?? $GPTXT,01,01,02,ROM CORE 1.00 (59842) Jun 27 2012 17:43:52*59
  • ??:??:?? $GPTXT,01,01,02,PROTVER 14.00*1E
  • ??:??:?? $GPTXT,01,01,02,ANTSUPERV=AC SD PDoS SR*20
  • ??:??:?? $GPTXT,01,01,02,ANTSTATUS=DONTKNOW*33
  • ??:??:?? $GPTXT,01,01,02,LLC FFFFFFFF-FFFFFFFD-FFFFFFFF-FFFFFFFF-FFFFFFFD*2E
  • ??:??:?? $GPRMC,V,N*53
  • ??:??:?? $GPVTG,N*30
  • ??:??:?? $GPGGA,0,00,99.99,*48
  • ??:??:?? $GPGSA,A,1,99.99,99.99,99.99*30
  • ??:??:?? $GPGLL,V,N*64
  • ??:??:?? $GPTXT,01,01,02,ANTSTATUS=INIT*25
  • ??:??:?? $GPRMC,V,N*53
  • ??:??:?? $GPVTG,N*30
  • ??:??:?? $GPGGA,0,00,99.99,*48
  • ??:??:?? $GPGSA,A,1,99.99,99.99,99.99*30
  • ??:??:?? $GPGLL,V,N*64
  • ??:??:?? $GPTXT,01,01,02,ANTSTATUS=OK*3B
    And how my app sends it’s own data:
  • ??:??:?? $GPTXT,01,01,02,u-blox ag - www.u-blox.com*50
  • ??:??:?? $GPTXT,01,01,02,ROM CORE 1.00 (59842) Jun 27 2012 17:43:52*59
  • ??:??:?? $GPTXT,01,01,02,PROTVER 14.00*1E
  • ??:??:?? $GPTXT,01,01,02,ANTSUPERV=AC SD PDoS SR*20
  • ??:??:?? $GPTXT,01,01,02,ANTSTATUS=INIT*25
  • ??:??:?? $GPTXT,01,01,02,ANTSTATUS=OK*3B
  • ??:??:?? $GPTXT,01,01,02,LLC FFFFFFFF-FFFFFFFD-FFFFFFFF-FFFFFFFF-FFFFFFFD*2E
  • ??:??:?? $GNGSA,A,1,*00
  • ??:??:?? $PQGSA,A,1,*08
  • ??:??:?? $GPVTG,T,M,N,K,N*2C
  • ??:??:?? $GPRMC,V,N*53
  • ??:??:?? $GPGGA,0,*66
    I don’t understand why the parsing algorithm in the APM and u-center give different results. Can someone enlighten me on how the parsing algorithm works in APM so I could convince it that my GPS is valid.
2 Likes

Since good GPS modules are expensive and phones have a lot of positioning systems build in I decided to try and use an android smartphone as a GPS source

“good” is rather subjective. A GPS equivalent to those found in most
phones can be had for not-much-money.

for the APM. I have successfully made an app that connects to a usb to serial converter and sends the position data in NMEA format. When I connect this

Are you maintaining a 5Hz update rate?

I think it is maintained at 1Hz, but connecting a cheap NEO-6M which also has a 1Hz refresh rate still works with APM.

Nope. AFAIK the first thing that ardupilot does with that cheap NEO-6M GPS is to reconfigure it to operate at 5Hz.

I sniffed the commands that APM sends over to the GPS, they look like the following:
apm → gps

  • ??:??:?? $PUBX,41,1,0003,0001,38400,0*26
  • ??:??:?? $PGCMD,16,0,0,0,0,0*6A
  • ??:??:?? $PSRF100,0,38400,8,1,0*3C
    And as far as I looked in to this message I didn’t find any configuration regarding the update rate. It only tries to set serial speed to 38400 even though it fails because the gps data is sniffable at 9600.

What Ardupilot FW version are you using?

I’m using v3.2.1 since that’s the latest one for APM 2.X boards.

That version probably does not have the features I mentioned. So you will have to figure out how to set it properly. It needs at least 5Hz.
You would save yourself a lot of headakes by buying a newer generation autopilot with a flight capable GPS receiver. The Phone + FTDI cable is bulky and heavy.

There is no update any time this is last edited fw ,

But few more bucks to get pixhawk it’s more batter then apm. And 6m gps is not working properly with you need accuracy (i think) because it’s past generation technology and now it’s time to meet gnss with M8 also there is also available M9 this is more accurate then your mobile some cases.

Amicarlucas is right , heavy your copter more consume battery less flight time.

Thank you :slightly_smiling_face: