GPS integration

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
mr_swell
Posts: 3
Joined: Thu Sep 22, 2011 11:48 am

Re: GPS integration

Post by mr_swell »

Hallo MichalM_sk,
i have the Flyduino V2 (Mega2560/ and the GPS Mtk3329 connected serial2, it is ok, see in Multiwii GPS Signal and get FIx
http://store.diydrones.com/MediaTek_MT3329_GPS_10Hz_Adapter_Basic_p/mt3329-02.htm

I don't really know how can i do this, get 10Hz, i look in the GPS.pde, config.h etc, found nothing...
Configuration messages that I use for MTK 3329 chipset GPS module:

#define SBAS_INTEGRITY_ON "$PMTK319,1*24\r\n"
#define SBAS_TEST_ON "$PMTK319,0*25\r\n"
#define WAAS_ENABLE "$PMTK313,1*2E\r\n"
#define WAAS_DISABLE "$PMTK313,0*2F\r\n"
#define DGPS_SBAS_ON "$PMTK301,2*2E\r\n" // default is SBAS on

#define MEDIATEK_BAUD_RATE_38400 "$PMTK251,38400*27\r\n"
#define MEDIATEK_BAUD_RATE_57600 "$PMTK251,57600*2C\r\n"
#define MEDIATEK_BAUD_RATE_115200 "$PMTK251,115200*1F\r\n"
#define MEDIATEK_REFRESH_RATE_4HZ "$PMTK220,250*29\r\n" //refresh rate - 4Hz - 250 milliseconds
#define MEDIATEK_REFRESH_RATE_5HZ "$PMTK220,200*2C\r\n"
#define MEDIATEK_REFRESH_RATE_10HZ "$PMTK220,100*2F\r\n" //refresh rate - 10Hz - 100 milliseconds
#define MEDIATEK_FACTORY_RESET "$PMTK104*37\r\n" //clear current settings


Greetz
Jo

MichalM_sk
Posts: 89
Joined: Wed Jun 15, 2011 5:04 pm
Location: Slovakia

Re: GPS integration

Post by MichalM_sk »

mr_swell wrote:Hallo MichalM_sk,
i have the Flyduino V2 (Mega2560/ and the GPS Mtk3329 connected serial2, it is ok, see in Multiwii GPS Signal and get FIx
http://store.diydrones.com/MediaTek_MT3329_GPS_10Hz_Adapter_Basic_p/mt3329-02.htm

I don't really know how can i do this, get 10Hz, i look in the GPS.pde, config.h etc, found nothing...
Configuration messages that I use for MTK 3329 chipset GPS module:

#define SBAS_INTEGRITY_ON "$PMTK319,1*24\r\n"
#define SBAS_TEST_ON "$PMTK319,0*25\r\n"
#define WAAS_ENABLE "$PMTK313,1*2E\r\n"
#define WAAS_DISABLE "$PMTK313,0*2F\r\n"
#define DGPS_SBAS_ON "$PMTK301,2*2E\r\n" // default is SBAS on

#define MEDIATEK_BAUD_RATE_38400 "$PMTK251,38400*27\r\n"
#define MEDIATEK_BAUD_RATE_57600 "$PMTK251,57600*2C\r\n"
#define MEDIATEK_BAUD_RATE_115200 "$PMTK251,115200*1F\r\n"
#define MEDIATEK_REFRESH_RATE_4HZ "$PMTK220,250*29\r\n" //refresh rate - 4Hz - 250 milliseconds
#define MEDIATEK_REFRESH_RATE_5HZ "$PMTK220,200*2C\r\n"
#define MEDIATEK_REFRESH_RATE_10HZ "$PMTK220,100*2F\r\n" //refresh rate - 10Hz - 100 milliseconds
#define MEDIATEK_FACTORY_RESET "$PMTK104*37\r\n" //clear current settings


Greetz
Jo


these configuration messages I use in my GPS to I2c board, in multiwii firmware with directly connected serial GPS it isnt implemented yet.

In a short time (when I fix crashed quadcopter) I add a new version of multiWii firmware with MediaTek serial configuration + patch 2 + some code changes + GPS telemetry support

mr_swell
Posts: 3
Joined: Thu Sep 22, 2011 11:48 am

Re: GPS integration

Post by mr_swell »

hi micha,
i am glad to test it
(when I fix crashed quadcopter)
= possibly your gps flight ;)
thx
jo

crashlander
Posts: 506
Joined: Thu May 05, 2011 8:13 am
Location: Slovenia

Re: GPS integration

Post by crashlander »

Hello!
I'm using couple of years old GPS module form SparkFun (LS20031, it is 32 channel and 1Hz) which defaults to 57600bps (and I set it in code) and I'm unable to change that (tried suggestions from previous posts with no success).
By default it is "producing" code like that (without position lock):
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPGSV,1,1,00*79
$GPRMC,235951.426,V,8960.0000,N,00000.0000,E,0.00,0.00,050180,,,N*74
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N*32
$GPGGA,235951.626,8960.0000,N,00000.0000,E,0,0,,137.0,M,13.0,M,,*48
$GPGLL,8960.0000,N,00000.0000,E,235951.626,V,N*4D
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPGSV,1,1,00*79
$GPRMC,235951.626,V,8960.0000,N,00000.0000,E,0.00,0.00,050180,,,N*76
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N*32

But I can not see anything (when connected to MultiWii GUI) with or without position lock.
Any suggestions?!

MichalM_sk
Posts: 89
Joined: Wed Jun 15, 2011 5:04 pm
Location: Slovakia

Re: GPS integration

Post by MichalM_sk »


crashlander
Posts: 506
Joined: Thu May 05, 2011 8:13 am
Location: Slovenia

Re: GPS integration

Post by crashlander »

MichalM_sk wrote:Hi,

you use this version?
viewtopic.php?f=8&t=649&start=20#p3555

I'm using version from Alex, from SVN. I don't have enough tools/expiriences to create custom PCB, program and solder Atmega168. Could you design Arduino (ProMini) based board and firmware?

Andrej

MichalM_sk
Posts: 89
Joined: Wed Jun 15, 2011 5:04 pm
Location: Slovakia

Re: GPS integration

Post by MichalM_sk »

This firmware viewtopic.php?f=8&t=649&start=20#p3555 also works with serial GPS module.
Another multiwii config utility doesn't permit display GPS info currently.

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: GPS integration

Post by Alexinparis »

crashlander wrote:Hello!
I'm using couple of years old GPS module form SparkFun (LS20031, it is 32 channel and 1Hz) which defaults to 57600bps (and I set it in code) and I'm unable to change that (tried suggestions from previous posts with no success).
By default it is "producing" code like that (without position lock):
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPGSV,1,1,00*79
$GPRMC,235951.426,V,8960.0000,N,00000.0000,E,0.00,0.00,050180,,,N*74
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N*32
$GPGGA,235951.626,8960.0000,N,00000.0000,E,0,0,,137.0,M,13.0,M,,*48
$GPGLL,8960.0000,N,00000.0000,E,235951.626,V,N*4D
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPGSV,1,1,00*79
$GPRMC,235951.626,V,8960.0000,N,00000.0000,E,0.00,0.00,050180,,,N*76
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N*32

But I can not see anything (when connected to MultiWii GUI) with or without position lock.
Any suggestions?!


Hi,
I've uploaded a new dev (28 september), could you try this one ?

msev
Posts: 186
Joined: Thu Apr 14, 2011 11:49 am

Re: GPS integration

Post by msev »

Will this gps integration be universal, work with different gps's from cheap one's with low update rate to the faster, better, more expensive 10Hz one's :D ?

crashlander
Posts: 506
Joined: Thu May 05, 2011 8:13 am
Location: Slovenia

Re: GPS integration

Post by crashlander »

Hello,
@Alexinparis: yes now it works (in GUI) I can see data at 57600bps
@MichalM_sk: sorry I vas unaware that it works with serial GPS, but now I tested it and can see data in GUI. But my current (new) Mega shield only supports Spektrum satellite receiver, so I'm currently unable to test any further with your code.

Regards Andrej

Gaza07
Posts: 12
Joined: Sat Apr 23, 2011 9:28 pm
Location: Nottingham Uk

Re: GPS integration

Post by Gaza07 »

Ive got a flyduino mega v1.1 with 1280 chip and a fmp-04 gps module on serial 2, the gps works with the latest multiwii dev, my gps works on the NMEA protocol and the baud set to 38400bps :D
cheers
Gazza

cob
Posts: 37
Joined: Thu Jul 07, 2011 12:00 am

Re: GPS integration

Post by cob »

I've got GPS working on Blackvortex board with Atmel 2560. It is a NEO-6Q Ublox GPS receiver.
I just configured like this in config.h MWII 1.8 by MichalM_sk:

Code: Select all

/* Serial GPS
   only available on MEGA boards
   if enabled, define here the Arduino Serial port number and the UART speed
   note: only the RX PIN is used, the GPS is not configured by multiwii
   the GPS must be configured to output NMEA sentences (which is generally the default conf for most GPS devices)
*/
#define GPS_SER
#define GPS_SERIAL Serial2 // should be Serial2 for flyduino v2 ... and it is for Blackvortex
#define GPS_BAUD   38400

So i get the GPS values displaying nicely on the GUI

User avatar
aBUGSworstnightmare
Posts: 115
Joined: Mon Jun 27, 2011 8:31 pm
Location: Munich, Germany

Re: GPS integration

Post by aBUGSworstnightmare »

Hi there,

is there a version were I can configure my GPS with? The current gps.pde does not allow to send configuration messages to the GPS, so were to find one which can do this?

I'm working on a GPS BOB which I want to test with the MultiWii software. The module runs on 4800baud, sending NMEA messages. I want to increase the baud rate by sending the appropriate command.

Thanks for answering.
aBUGSworstnightmare

P.S. Here's a picture of my current dev (in progress). Sry, no details on the module at the moment :?:
Attachments
aBUGSworstnightmare's GPS BOB
aBUGSworstnightmare's GPS BOB

User avatar
dramida
Posts: 473
Joined: Mon Feb 28, 2011 12:58 pm
Location: Bucharest
Contact:

Re: GPS integration

Post by dramida »

I am ready to test GPS HOLD function with my multiwii octocopter, when it will be available?

didlawowo69
Posts: 38
Joined: Tue Oct 11, 2011 1:42 pm

Re: GPS integration

Post by didlawowo69 »

any news about gps integration ?
HK gps with OSD have a good resolution ?

whowe
Posts: 12
Joined: Thu Oct 20, 2011 4:04 am

Re: GPS integration

Post by whowe »

I don't like the idea of soft serial. I believe it takes too much CPU resource to do the UART simulation.
When flying, serial 0 is not in use. So I think sharing serial 0 with PC is a good idea.

ziss_dm
Posts: 529
Joined: Tue Mar 08, 2011 5:26 am

Re: GPS integration

Post by ziss_dm »


User avatar
jevermeister
Posts: 708
Joined: Wed Jul 20, 2011 8:56 am
Contact:

Re: GPS integration

Post by jevermeister »

Hi,
Paul from Flyduino sent me a GPS bob to test with but I have some startup problems.
I use a FLyduino v2.1 and I am unsure which serial I have to use with the 20111029 DEV version,
I need to use the serial Port with RX3 TX3 written on it, because the bob does not have the smal gps connector yet.

Which serial port is that? Serial3?

Nils

ps.: GPS TX to Flyduino RX?

User avatar
aBUGSworstnightmare
Posts: 115
Joined: Mon Jun 27, 2011 8:31 pm
Location: Munich, Germany

Re: GPS integration

Post by aBUGSworstnightmare »

Hi there,

Nils, as already mentioned you need to do a 1:1 connection between the GPS and the Flyduino Mega.
I hope to have the connector at hands by the end of the week --> send me a PN with your address and I will mail one.

Well, I couldn't locate in the code which UART is assigned to the GPS.
Config.h only lets you choose

Code: Select all

/* GPS     only available on MEGA boards (this might be possible on 328 based boards in the future)     if enabled, define here the Arduino Serial port number and the UART speed     note: only the RX PIN is used, the GPS is not configured by multiwii     the GPS must be configured to output NMEA sentences (which is generally the default conf for most GPS devices)  */  //#define GPS  //#define GPS_SERIAL Serial3 // should be Serial2 for flyduino v2  //#define GPS_BAUD   4800  //#define GPS_BAUD   9600  


with def.h redefines this to

Code: Select all

Def.h only gives

[code]#if defined(GPS)    #define GPSPRESENT 1  #else    #define GPSPRESENT 0  #endif  [/code]



But, were in the code is GPSPRESENT and GPS_BAUD used so far???

MultiWii.pde only has

Code: Select all

  #if defined(GPS)      GPS_SERIAL.begin(GPS_BAUD);    #endif  

but were is GPS_SERIAL assigned?

Rgds
aBUGSworstnightmare
Attachments
aBUGSworstnightmare GPS connected to FTDI for testing
aBUGSworstnightmare GPS connected to FTDI for testing

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: GPS integration

Post by Alexinparis »

Hi,

GPSPRESENT is used to set a bit in a variable (GUI communication) to indicate the presence of the GPS.
GPS_BAUD and GPS_SERIAL are defined in config.h and used in multiwii.pde

aBUGSworstnightmare wrote:Hi there,

Nils, as already mentioned you need to do a 1:1 connection between the GPS and the Flyduino Mega.
I hope to have the connector at hands by the end of the week --> send me a PN with your address and I will mail one.

Well, I couldn't locate in the code which UART is assigned to the GPS.
Config.h only lets you choose

Code: Select all

/* GPS     only available on MEGA boards (this might be possible on 328 based boards in the future)     if enabled, define here the Arduino Serial port number and the UART speed     note: only the RX PIN is used, the GPS is not configured by multiwii     the GPS must be configured to output NMEA sentences (which is generally the default conf for most GPS devices)  */  //#define GPS  //#define GPS_SERIAL Serial3 // should be Serial2 for flyduino v2  //#define GPS_BAUD   4800  //#define GPS_BAUD   9600  


with def.h redefines this to

Code: Select all

Def.h only gives

[code]#if defined(GPS)    #define GPSPRESENT 1  #else    #define GPSPRESENT 0  #endif  [/code]



But, were in the code is GPSPRESENT and GPS_BAUD used so far???

MultiWii.pde only has

Code: Select all

  #if defined(GPS)      GPS_SERIAL.begin(GPS_BAUD);    #endif  

but were is GPS_SERIAL assigned?

Rgds
aBUGSworstnightmare

User avatar
aBUGSworstnightmare
Posts: 115
Joined: Mon Jun 27, 2011 8:31 pm
Location: Munich, Germany

Re: GPS integration

Post by aBUGSworstnightmare »

Hi Alex,

yes, that's clear! But were can I see which hardware UART is associated to/with GPS_SERIAL label?

Rgds
aBUGSworstnightmare

Alexinparis wrote:Hi,

GPSPRESENT is used to set a bit in a variable (GUI communication) to indicate the presence of the GPS.
GPS_BAUD and GPS_SERIAL are defined in config.h and used in multiwii.pde

aBUGSworstnightmare wrote:Hi there,

Nils, as already mentioned you need to do a 1:1 connection between the GPS and the Flyduino Mega.
I hope to have the connector at hands by the end of the week --> send me a PN with your address and I will mail one.

Well, I couldn't locate in the code which UART is assigned to the GPS.
Config.h only lets you choose

Code: Select all

/* GPS     only available on MEGA boards (this might be possible on 328 based boards in the future)     if enabled, define here the Arduino Serial port number and the UART speed     note: only the RX PIN is used, the GPS is not configured by multiwii     the GPS must be configured to output NMEA sentences (which is generally the default conf for most GPS devices)  */  //#define GPS  //#define GPS_SERIAL Serial3 // should be Serial2 for flyduino v2  //#define GPS_BAUD   4800  //#define GPS_BAUD   9600  


with def.h redefines this to

Code: Select all

Def.h only gives

[code]#if defined(GPS)    #define GPSPRESENT 1  #else    #define GPSPRESENT 0  #endif  [/code]



But, were in the code is GPSPRESENT and GPS_BAUD used so far???

MultiWii.pde only has

Code: Select all

  #if defined(GPS)      GPS_SERIAL.begin(GPS_BAUD);    #endif  

but were is GPS_SERIAL assigned?

Rgds
aBUGSworstnightmare

JohnyGab
Posts: 144
Joined: Sat Oct 29, 2011 4:41 am

Re: GPS integration

Post by JohnyGab »

Did you guy see any problem working the gps at 115200 on mega board?

User avatar
jevermeister
Posts: 708
Joined: Wed Jul 20, 2011 8:56 am
Contact:

Re: GPS integration

Post by jevermeister »

I tested it with 115200 on my flyduino, the data looked good, but I have not flown it yet...

Nils

Ben_der
Posts: 9
Joined: Thu Aug 25, 2011 5:22 pm

Re: GPS integration

Post by Ben_der »

What about piping the NMEA-Frame delivered by I2C GOS Devices with UART-mimic?
Maybe the Fastrax IT 430 ?

something like :

Code: Select all

const int WANTED_NUMBER = 67; // A usual GPGGA NMEA frame, 67 bytes including $;<CR>;<LF>
static uint8_t datastring [WANTED_NUMBER];
static uint32_t gpscycle;


Code: Select all

#if defined (SOME_GPS_I2C)
  getData();
  while (Wire.available()) {
  if (GPS_newFrame(datastring [WANTED_NUMBER])){
      if (GPS_update == 1) GPS_update = 0;
      else GPS_update = 1;
      if (GPS_fix == 1) {
        if (GPS_fix_home == 0) {
          GPS_fix_home = 1;
          GPS_latitude_home = GPS_latitude;
          GPS_longitude_home = GPS_longitude;
        }
        GPS_distance(GPS_latitude_home,GPS_longitude_home,GPS_latitude,GPS_longitude, &GPS_distanceToHome, &GPS_directionToHome);
      }
    }
  }


&

Code: Select all

float getData ()
      {
      TWBR = ((16000000L / 400000L) - 16) / 2;
      i2c_rep_start(0x60);                     //GPS sample I2c address
           for (byte i = 0; i < WANTED_NUMBER; i++)
           datastring [i] = i2c_readAck();
           datastring [WANTED_NUMBER]= i2c_readNak();           
           return datastring[WANTED_NUMBER];                 // maybe here we will need a terminating null
             if ( (micros()-gpscycle )  < 250000 );   
                 gpscycle = micros();             //250ms = 4Hz refresh;
             getData();                                         
      }
 


roundabout...not tested..waiting for module but will have to switch with a I2C PCA.. least problem i think...

User avatar
dialfonzo
Posts: 62
Joined: Sun Nov 20, 2011 3:18 pm
Location: Quebec, Canada

Re: GPS integration

Post by dialfonzo »

Hi All,

I have hook a GPS to my Mega board yesterday.

Activate the code in config.h

Code: Select all

#define GPS
#define GPS_SERIAL Serial3 // should be Serial2 for flyduino v2
#define GPS_BAUD   4800


The GPS look to work since the GUI tell me that i have setellites...
Picture of GUI
http://static.rcgroups.net/forums/attachments/1/7/6/6/8/9/a4427740-182-MultiWii%20-%20Arduino%20Mega%201280%20-%20GPS.png

I wonder how do i know if it work.. or if i have position data ?

User avatar
jevermeister
Posts: 708
Joined: Wed Jul 20, 2011 8:56 am
Contact:

Re: GPS integration

Post by jevermeister »

If you have satellites: It works.

kataventos
Posts: 702
Joined: Sun Aug 28, 2011 8:14 pm
Contact:

Re: GPS integration

Post by kataventos »

Hi, is there any news about promini integration? I would like to have one on my Paris v4 board! :)

User avatar
dramida
Posts: 473
Joined: Mon Feb 28, 2011 12:58 pm
Location: Bucharest
Contact:

Re: GPS integration

Post by dramida »

Hi guys, I need GPS Position hold for making aerial panoramas. Here you can see my albums.

http://caseta.ro/html/fotografie_aeriana.html

User avatar
dialfonzo
Posts: 62
Joined: Sun Nov 20, 2011 3:18 pm
Location: Quebec, Canada

Re: GPS integration

Post by dialfonzo »

I need a Ferrari...!

kataventos
Posts: 702
Joined: Sun Aug 28, 2011 8:14 pm
Contact:

Re: GPS integration

Post by kataventos »

dialfonzo wrote:I need a Ferrari...!


:lol: First the position hold then the Ferrari, one thing at a time!

User avatar
dialfonzo
Posts: 62
Joined: Sun Nov 20, 2011 3:18 pm
Location: Quebec, Canada

Re: GPS integration

Post by dialfonzo »

kataventos wrote:
dialfonzo wrote:I need a Ferrari...!


:lol: First the position hold then the Ferrari, one thing at a time!



LOL.. ;)

User avatar
dramida
Posts: 473
Joined: Mon Feb 28, 2011 12:58 pm
Location: Bucharest
Contact:

Re: GPS integration

Post by dramida »

I started dreaming at GPS position hold for a while. Please Santa, upload the CODE!

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: GPS integration

Post by Alexinparis »

Hi,
I uploaded yesterday a dev snapshot with some GPS dev.
The GPS return to home function is coded.
Not yet tested, but in progress.

User avatar
jevermeister
Posts: 708
Joined: Wed Jul 20, 2011 8:56 am
Contact:

Re: GPS integration

Post by jevermeister »

I like!!
Will test it asap

Noctaro
Posts: 280
Joined: Thu Sep 08, 2011 11:15 am
Contact:

Re: GPS integration

Post by Noctaro »

AHRG!
Great! Are there any wiring howtos for gps modules around? Am i limited to some special hardware?

greetings
Noctaro

kataventos
Posts: 702
Joined: Sun Aug 28, 2011 8:14 pm
Contact:

Re: GPS integration

Post by kataventos »

Hi Alex,
great! Any news on promini? I think that exist some kind of "breakout" board that is able to convert serial to i2C! is that it? where can I find this and does it realy work?

Cheers,
Henrique

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: GPS integration

Post by PatrikE »

Found a little Typo
Could not get it to work with serialport 3

Code: Select all

   while (SerialAvailable(2)) {
     if (GPS_newFrame(SerialRead(2))) {

Should be if you want to switch port in config.

Code: Select all

   while (SerialAvailable(GPS_SERIAL)) {
     if (GPS_newFrame(SerialRead(GPS_SERIAL))) {


Now it's running smooth on the table.
Will test when it's not snowing so much.. :?

/Patrik

User avatar
mbrak
Posts: 136
Joined: Sat Dec 03, 2011 8:08 pm
Location: Germany, Lemgo

Re: GPS integration

Post by mbrak »

hi

a small question

is it possible to assign an output-pin if having a gps-link?
i think it is not bad to have a led when there are enough satelites.

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: GPS integration

Post by Alexinparis »

Hi,

Currently, there is a change of the status LED when a fix is obtained
When the motors are not armed, the status LED should stay off.
Once the fix is ok, there is a specific blink pattern.

User avatar
dramida
Posts: 473
Joined: Mon Feb 28, 2011 12:58 pm
Location: Bucharest
Contact:

Re: GPS integration

Post by dramida »

Today I just crushed my octo and it will take me some time to fix it, i am sorry that i can't do the tests.

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: GPS integration

Post by Alexinparis »

Hi,

Just some precisions about the current GPS dev code:

1) hardware setup:

An arduino mega (might change in the future for a promini, but not yet) with the GPS connected on serial port 2 (customizable, but with the typo correction just mentionned by PatrikE). I'm currently using the flyduino MEGA.

You must configure the right baud speed of the GPS port according to your GPS device. (#define GPS + #define GPS_SERIAL 2 + #define GPS_BAUD 115200)

You need a NMEA GPS compatible (most serial GPS are compatible). Currently multiwii does not configure the GPS device (will change in the future). So your GPS device must be already configured to output these frames. A 5 or 10Hz is preferable. This update rate is not configurable inside multiwii, multiwii takes what it receives. I'm now using the 10Hz FMP04 GPS with the GPS BOB from flyduino.

All the sensors GYRO+ACC+MAG are mandatory. Your multi must be perfectly tuned in level and heading (mag) mode. Your mag direction should not be altered by running motors (this point is very important). Your MAG arrow must point the north direction.

Baro is not mandatory, but a working baro config in preferable.

2) visualization

If the GPS is correctly connected and configured. You should see the GPS blinking in the GUI (around the grey rosace N/S/E/W in the GUI) according to its update rate.

A specific Status LED blink pattern occurs when motors are disarmed and once a fix is ok.

Once a fix is ok, you should see the number of satellites and the distance to the first fix position (home) in the GUI.

3) activating the GPS

The GPS must be activated (via checkbox and AUX configuration) only if a fix is ok. The home will be set with the first fix.

The GPS can be only activated if level mode if also activated. (MAG mode activation or BARO mode activation are not mandatory)

The current implementation only supports Return To Home function (PH will be easy to add)

Once activated, the GPS will rely on 3 parameters to work
distance to the target point (calculation obtained from GPS device)
absolute direction to the target point (calculation obtained from GPS device)
heading direction (calculation obtained from MAG+ACC device)

The target point distance is used to determine an angle inclination.
A PID has been added to the GUI, but it's not currently a real PID.
P is used to tune the proportion of inclination regarding the distance to the target point.
I is not used
D is used to limit the max inclination

The combination of direction to the target point+heading direction is used to apply a mix on the motors to follow the right direction.

User avatar
mbrak
Posts: 136
Joined: Sat Dec 03, 2011 8:08 pm
Location: Germany, Lemgo

Re: GPS integration

Post by mbrak »

Thanks Alex for this masterpice of software!

My copter has GPS now and it seems to work fine. (flyduino Mega with FMP04 GPS from Paul)

Will it be possible in future to reset the home-point an set a new one without power down the copter?

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: GPS integration

Post by PatrikE »

mbrak wrote:Will it be possible in future to reset the home-point an set a new one without power down the copter?

It should be easy to do it now to..

Code: Select all

  #if defined(GPS)
    if ( (GPSModeHome == 1) && ( GPS_fix_home == 1)) {
      float radDiff = (GPS_directionToHome-heading) * 0.0174533f;
      GPS_angle[ROLL]  = constrain(P8[PIDGPS] * sin(radDiff) * GPS_distanceToHome / 10,-D8[PIDGPS]*10,+D8[PIDGPS]*10); // with P=5, 1 meter = 0.5deg inclination
      GPS_angle[PITCH] = constrain(P8[PIDGPS] * cos(radDiff) * GPS_distanceToHome / 10,-D8[PIDGPS]*10,+D8[PIDGPS]*10); // max inclination = D deg
    } else {
      GPS_angle[ROLL]  = 0;
      GPS_angle[PITCH] = 0;
      GPS_fix_home =0
    }
  #endif


If you set GPS_fix_home =0 when GPSModeHome isn't active it vill take a new position and use it as home when GPSModeHome is Reactivated.

User avatar
dramida
Posts: 473
Joined: Mon Feb 28, 2011 12:58 pm
Location: Bucharest
Contact:

Re: GPS integration

Post by dramida »

I tested R426 software with GPS return to home.

http://www.youtube.com/watch?v=CpmluiZ_044

Mag was calibrated and checked in GUI, level mode working and GPS fix available because status led was blinking fast.
When activated GPS return to home, i programmed to activate the buzzer .

The results are not conclusive, i think something gone wrong because the quad is not going in right direction, but also CF mode was not working. Strange because i calibrated and checked the mag and on previous version, one day before, the CF mode was working well.
Also i observed short bursts of yaw when mag was active in Head hold.

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: GPS integration

Post by Alexinparis »

Hi dramida,

The CF (HeadFree) mode should work perfectly before testing the GPS, because the GPS will rely on the magnetic orientation.
Your mag is working well on the bench, but could you confirm it works also when the motors are running ?

I suspect some magnetic noise coming from ESCs or motors, and leading to a wrong heading information.

User avatar
mbrak
Posts: 136
Joined: Sat Dec 03, 2011 8:08 pm
Location: Germany, Lemgo

Re: GPS integration

Post by mbrak »

hi

i tested the dev 20111220 today. the mag was well calibrated and the gui values good. the hf-mode was not working correctly! at yaw angles<90 degrees it worked fine but >90 degrees to the start orientation the copter was flying in other directions but not in that, i would like to have him.

after that i did not test gps.

what can we do in case of magnetic interference? any solutions?

User avatar
dramida
Posts: 473
Joined: Mon Feb 28, 2011 12:58 pm
Location: Bucharest
Contact:

Re: GPS integration

Post by dramida »

My tests were faulty because magnetometer goes crazy when motors are over 50% or more. I saw this behaviour on GUI wile holding in my hand with engines powered. So until the mag stays on position at any power, i cannot conclude about soft.

User avatar
mbrak
Posts: 136
Joined: Sat Dec 03, 2011 8:08 pm
Location: Germany, Lemgo

Re: GPS integration

Post by mbrak »

Hi

my tests have the same result as that of dramida. MAG is going crazy over all 3 axis as soon as more like hover-throttle(aprox. 40%) is present.
motors : T-Motor2216/KV900 10x4.7 CF with robbe roxxy bl820 ESC

i increased the space between IMU (10 DOF AllinOne / Ebay from CSG_EU) and frame with powerlines (flyduino quadframe) up to 15mm. next test will show the result.

After increasing space the MAG is now more softly! much better than before!

Will do some testing tomorrow if there is no rain.....

User avatar
UndCon
Posts: 293
Joined: Mon Feb 21, 2011 2:10 pm

Re: GPS integration

Post by UndCon »

Can you try shielding things to verify it is the motors and mot ESC's that causes MAG errors?

//UndCon

User avatar
mbrak
Posts: 136
Joined: Sat Dec 03, 2011 8:08 pm
Location: Germany, Lemgo

Re: GPS integration

Post by mbrak »

UndCon wrote:Can you try shielding things to verify it is the motors and mot ESC's that causes MAG errors?

//UndCon



Magnetic shielding you mean? what exactly do you think?

I should try to shield the electromagnetic compatibility of the ESC? how?

Post Reply