AGPS(Assisted GPS) data injection support

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
Post Reply
bluejune
Posts: 8
Joined: Mon Jul 14, 2014 3:07 am

AGPS(Assisted GPS) data injection support

Post by bluejune »

Hi,

Some GPS module such as ublox NEO-6M supports AGPS data injection.
AGPS data can be obtained easily if a request packet is sent to ublox-agps server.
Good example python codes are here (http://wiki.openmoko.org/wiki/Neo_FreeR ... ementation)

I modified protol.cpp codes to send AGPS data from the Android phone to GPS module like below.
I can see GPS position fix in a minute even if cold start is asserted.
Is there any plan to add AGPS data injection command?

Code: Select all

@@ -53,6 +54,8 @@
 #define MSP_SET_SERVO_CONF       212   //in message          Servo settings
 #define MSP_SET_MOTOR            214   //in message          PropBalance function

+#define MSP_TX_GPS_DATA          215   //in message          AGPS injection
+
 #define MSP_BIND                 240   //in message          no param

 #define MSP_EEPROM_WRITE         250   //in message          no param
@@ -71,7 +74,7 @@

@@ -79,7 +82,7 @@ static uint8_t cmdMSP[UART_NUMBER];

 void evaluateOtherData(uint8_t sr);
 #ifndef SUPPRESS_ALL_SERIAL_MSP
-void evaluateCommand();
+void evaluateCommand(uint8_t len);
 #endif

 #define BIND_CAPABLE 0;  //Used for Spektrum today; can be used in the future for any RX type that needs a bind and has a MultiWii
@@ -218,7 +221,7 @@ void serialCom() {
           inBuf[offset[CURRENTPORT]++][CURRENTPORT] = c;
         } else if (c_state[CURRENTPORT] == HEADER_CMD && offset[CURRENTPORT] >= dataSize[CURRENTPORT]) {
           if (checksum[CURRENTPORT] == c) {  // compare calculated and transferred checksum
-            evaluateCommand();  // we got a valid packet, evaluate it
+            evaluateCommand(dataSize[CURRENTPORT]);  // we got a valid packet, evaluate it
           }
           c_state[CURRENTPORT] = IDLE;
           cc = 0; // no more than one MSP per port and per cycle
@@ -239,10 +242,20 @@ void s_struct_w(uint8_t *cb,uint8_t siz)
 }

 #ifndef SUPPRESS_ALL_SERIAL_MSP
-void evaluateCommand() {
+void evaluateCommand(uint8_t len) {
   uint32_t tmp=0;

   switch(cmdMSP[CURRENTPORT]) {
+
+#if GPS
+   case MSP_TX_GPS_DATA:
+     for (uint8_t i = 0; i < len; i++) {
+       SerialWrite(GPS_SERIAL, read8());
+       delay(5);
+     }
+     headSerialReply(0);
+     break;
+#endif
+
    case MSP_SET_RAW_RC:
      s_struct_w((uint8_t*)&rcSerial,16);
      rcSerialCount = 50; // 1s transition
Last edited by bluejune on Mon Sep 01, 2014 2:59 pm, edited 1 time in total.

User avatar
Leon11t
Posts: 38
Joined: Thu Sep 27, 2012 12:24 pm

Re: AGPS(Assisted GPS) data injection support

Post by Leon11t »

How do you send data from phone? Whot software in phone do you use?

bluejune
Posts: 8
Joined: Mon Jul 14, 2014 3:07 am

Re: AGPS(Assisted GPS) data injection support

Post by bluejune »

I made an android application fetching the AGPS data from ublox-server and send them through bluetooth.

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: AGPS(Assisted GPS) data injection support

Post by Hamburger »

:)
seems like without access to your app the mwii modification would not be of use for too many people.
So are you providing that app too?

scrat
Posts: 925
Joined: Mon Oct 15, 2012 9:47 am
Location: Slovenia

Re: AGPS(Assisted GPS) data injection support

Post by scrat »

And BT is limited to 100m max.

bluejune
Posts: 8
Joined: Mon Jul 14, 2014 3:07 am

Re: AGPS(Assisted GPS) data injection support

Post by bluejune »

Actually AGPS data injection is not used when copter flies.
It is only used for accelerating GPS fix before flight.

scrat
Posts: 925
Joined: Mon Oct 15, 2012 9:47 am
Location: Slovenia

Re: AGPS(Assisted GPS) data injection support

Post by scrat »

Aha. Thx!

bluejune
Posts: 8
Joined: Mon Jul 14, 2014 3:07 am

Re: AGPS(Assisted GPS) data injection support

Post by bluejune »

Android application for testing this feature is uploaded at
https://play.google.com/store/apps/deta ... soft.btcon

scrat
Posts: 925
Joined: Mon Oct 15, 2012 9:47 am
Location: Slovenia

Re: AGPS(Assisted GPS) data injection support

Post by scrat »

So that means I just enable GPS on my phone and connect app over BT with FC and wait few seconds for satelittes to show?

bluejune
Posts: 8
Joined: Mon Jul 14, 2014 3:07 am

Re: AGPS(Assisted GPS) data injection support

Post by bluejune »

Yes.. only if you installed u-blox GPS module on your FC :D

Here is basic idea of A-GPS and the application uses u-blox server to get the information.
(http://en.wikipedia.org/wiki/Assisted_GPS)
Standalone/self-ruling GPS units depend solely on radio indicators from satellites. A-GPS develops that by likewise using cell tower data to enhance unwavering quality and precision when in poor satellite signal conditions. In exceptionally poor sign conditions, for example, in urban territories, satellite signs may endure multipath propagation where signals skip off structures, or are weakened by barometrical conditions, dividers, or tree spread. Some standalone GPS route gadgets, when utilized within poor conditions, will be unable to focus a position because of satellite sign fracture and must hold up for a finer satellite indicator. A GPS unit may require as long as 12.5 minutes (the time needed to download the GPS almanac and ephemeris) to resolve the problem and be able to provide a correct location.
An assisted GPS system can address these problems by using data available from a network.

This app uses below assistance.
Mobile Station Based (MSB): Information used to acquire satellites more quickly.
It can supply orbital data or almanac for the GPS satellites to the GPS receiver, enabling the GPS receiver to lock to the satellites more rapidly in some cases.
The network can provide precise time.

I hope this helps you..

Arakon
Posts: 196
Joined: Thu Jul 17, 2014 2:22 pm

Re: AGPS(Assisted GPS) data injection support

Post by Arakon »

That code is conflicting with the navigation versions of multiwii.. 215 is already used.

#define MSP_SET_NAV_CONFIG 215 //in message Sets nav config parameters - write to the eeprom

bluejune
Posts: 8
Joined: Mon Jul 14, 2014 3:07 am

Re: AGPS(Assisted GPS) data injection support

Post by bluejune »

I add a command to codes based on MultiWii_dev_2014_01_14__r1648.
Actually that is what I worried. :x
Command number can be conflicted if the changes are not committed.
I'll change my application to set user defined command number.

phox
Posts: 1
Joined: Thu Feb 19, 2015 8:29 pm

Re: AGPS(Assisted GPS) data injection support

Post by phox »

It seems to be more of a waste of effort for this feature, most of the time you are outdoors. GNSS signals are pretty strong outdoors, AGPS is useful if you are in a weak signal area e.g. indoors
if you are outdoors and performing a cold start the time to fix is going to be 30-40secs.

cheers

Post Reply