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
flyrobot
Posts: 73
Joined: Thu Apr 05, 2012 3:59 pm

Re: GPS integration

Post by flyrobot »

flyrobot wrote:
flyrobot wrote:Hi Warthox,

Can you share what GPS do you use on the video?

Thanks,

John


Hi warthox,

Thanks for the info, what i meant is do you use serial (FMP04) or I2C (navigatron) ? I have both, but i see the difference in term of the signal reception sensitivity.

Thanks,

John


i dont know the update rate. it worked 'out of the box'.

my setting in config.h

Code: Select all

#define GPS_SERIAL 2 // should be 2 for flyduino v2. It's the serial port number on arduino MEGA
#define GPS_BAUD   38400
[/quote]
Thanks, yes i have same setting for serial using fmp04 and it works very good with flyduino mega.

But i have problem with I2C using navigatron v1 + quadrino. I have followed the guide from this thread. After update the firmware the gps to 10Hz and tested with minigps, it works. Update the quadrino R33 both navigatron and quadrino seems ok. But i didn't see the quadrino receive gps signal from the navigatron, the grey donut on the gui doesn't flashing.

Anyone have idea?

John

charbot
Posts: 34
Joined: Wed May 23, 2012 8:37 pm

Re: GPS integration

Post by charbot »

mahowik wrote:you are right that solution for serial gps (also possible on 328 when GUI off)...

for i2c GPS u can use this viewtopic.php?f=8&t=649&start=610#p14024
actually it's the same but with common Serial lib usage...



Thanks! that does the trick. ( Worst thing was that I probably skimmed over that post several times as i was trying to absorb all the info in this thread. Its just too popular!) Anyway.... which version of multiwii should I be using? The version included in the I2C_GPS_NAV zip seems to work (post GPS data, flashing ring) but the Mac GUI (115200 version )seems a little screwy- wont let me recalibrate mag or acc. I also tried MultiWii_dev_20120528 but doesnt seem to be getting any gps info- or at least doesnt display it, no flashing compass.

warthox
Posts: 65
Joined: Sat Jan 29, 2011 10:05 pm

Re: GPS integration

Post by warthox »

mahowik wrote:ok... thx.. i suppose u have 3329 with predefined 38400 baud and 5hz update rate accordingly...
to check this u can connect with MiniGPS_v1.7.1 to your GPS module

http://www.adafruit.com/datasheets/Mini ... _1.7.1.zip


its the MT3339 chipset.

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

Re: GPS integration

Post by dramida »

Results in GPS config:
using GPS moving averaging vector results in a better position hold
confih.h

#define GPS_FILTERING true // add a 5 element moving average filter to GPS coordinates, helps eliminate gps noise but adds latency

I am using a 10 element long filtering vector on a 10 hz NMEA sentence speed.
GPS.ino
// moving average filter variables
//

#define GPS_FILTER_VECTOR_LENGTH 10

Comparing with no filtering, the radius on a dead calm weather with clear sky has shrunk to 1-2 m. If i disable the filtering, the radius increases to 2-4 m.

I tried to yaw 360 degrees in position hold. This rotation induces great instability to position hold. Any idea why?

warthox
Posts: 65
Joined: Sat Jan 29, 2011 10:05 pm

Re: GPS integration

Post by warthox »

thats the hardware i used for the r33 gps video http://air-studio.eu/en/5-electronics

zarkon
Posts: 68
Joined: Sat Oct 15, 2011 8:25 am

Re: GPS integration

Post by zarkon »

it take me almost 2 day to finish reading all the post here :P, finally I'm done looking forward to get GPS working on my IOI 10DOF mini wii board, I already order the i2c GPS from flytron looking forward on testing it

Sharkcopter
Posts: 21
Joined: Fri Feb 24, 2012 3:12 pm

Re: GPS integration

Post by Sharkcopter »

Hi
Please can someone help me on the meaning of the blue and red LED on the card Navigatron V2 ?
What means the flashing ?
Thanks in advance

Tazzy
Posts: 75
Joined: Sun Jun 19, 2011 4:45 pm
Location: Sweden

Re: GPS integration

Post by Tazzy »

dramida wrote:Results in GPS config:
using GPS moving averaging vector results in a better position hold
confih.h

#define GPS_FILTERING true // add a 5 element moving average filter to GPS coordinates, helps eliminate gps noise but adds latency

I am using a 10 element long filtering vector on a 10 hz NMEA sentence speed.
GPS.ino
// moving average filter variables
//

#define GPS_FILTER_VECTOR_LENGTH 10

Comparing with no filtering, the radius on a dead calm weather with clear sky has shrunk to 1-2 m. If i disable the filtering, the radius increases to 2-4 m.

I tried to yaw 360 degrees in position hold. This rotation induces great instability to position hold. Any idea why?


Hello Dramida
What code do you fly with gps is it .r33

// Tazzy

fastsonic
Posts: 4
Joined: Thu Jun 07, 2012 8:25 pm

Re: GPS integration

Post by fastsonic »

Hi@all
can somebody help me to activate my GPS. :(
My story:
No Plan of Flashing, Arduino, Coding, Multii, only RC Helicopter and Planes..
Many Hours to Read about Multiwii,Arduino, Flashing, Buspirat,I2C, WINAVR, Hexefiles......
Sometimes hate it, somtimes happy like a kind when the Right LED blining.... and the TRI fly.
Hardware:
TRI
Crius SE.
New Baro MS561101BA
After Problems with the MAgnetic field i remove the Sensor from board an bring it onto the second higher Board .
This Second board is an Rushduino GPS with I2C.

NO I2C Errors All works fine after all the time..
But the GPS :(
I flash this one with an Buspirate directly on the 6Pinhead. I learnd a lot over this Buspirat. For two Week i know nothing ...
I use arduino to create the HEX File and flash the GPS:

avrdude -c buspirate -P com5 -p atmega328p -U flash:w:NAV.hex

Seems to be OK no Errors.
I found a second way to make configfile in Arduino to use the Buspirate directly. Also seems to be OK...
HEXFile is uploadet can somebody check it ?
It there a way to check the working Programm on the GPS ?
I can use the Buspirat as I2C reader ( also for 2 weeks no info about this)
I have one time an Error and try the Board with Error but then i become a lot of I2C Errors. Flash new an no i2C Errors but also no Fix ore something in the GUI
I try the Multiwii 04.05 and the 28.05 and the Multiwii in the Package R33
The Rushduinoboard have an SAT Fix but GUI still without GPS
in config.h i use the i2cGPS option and deactivate the seriell. is there somthing i must check? the Adress on the Multwiiside ?
Have anybody an tip for me.
Sorry for the Long Text and the Bad English..
Also PN´s ore Emails are Welcome.
Regards from Germany
Fastsonic
Attachments
NAV.zip
(16.11 KiB) Downloaded 222 times

Katch
Posts: 280
Joined: Thu Aug 04, 2011 1:44 pm

Re: GPS integration

Post by Katch »

Sharkcopter wrote:Hi
Please can someone help me on the meaning of the blue and red LED on the card Navigatron V2 ?
What means the flashing ?
Thanks in advance


Blue LED is Pin 13 on the arduino
Red is 3d fix on the GPS

Red flashing no lock - on 3d fix

Blue 3 fast flashes repeating - arduino receiving 3d lock

Tazzy
Posts: 75
Joined: Sun Jun 19, 2011 4:45 pm
Location: Sweden

Re: GPS integration

Post by Tazzy »

Alexinparis wrote:
EOSBandi wrote:
Nope, in the latest shared, it's overwritten by the GPS code. (both serial and i2c)

Code: Select all

       
 if (GPS_fix == 1 && GPS_numSat >= 5) {         
    if (armed == 0) {GPS_fix_home = 0;}
    if (GPS_fix_home == 0 && armed) {
             GPS_fix_home = 1;
             GPS_latitude_home  = GPS_latitude;
             GPS_longitude_home = GPS_longitude;
             GPS_calc_longitude_scaling(GPS_latitude);  //need an initial value for distance and bearing calc           
             nav_takeoff_bearing = heading;             //save takeoff heading         
      }


We need an agreement or a config def for this... both method has it's advantages.....


So yes, it's reset each time the multi is armed.
As suggested we can maybe let the choice to the user via a #define


How about to use same aux that activate gpshome so it will set new home pos if you flip the switch when the copter is landed and the motors is unarmed ? then we don't need one more aux for that function or need to calibrate to reset home pos.

// Tazzy

Tazzy
Posts: 75
Joined: Sun Jun 19, 2011 4:45 pm
Location: Sweden

Re: GPS integration

Post by Tazzy »

And here is my position hold result with default pids, i2c fmp-04 gps, and my gy-86 imu.
THANKS all developers !!

http://www.youtube.com/watch?v=sw-6EyAM15w&hd=1

// Tazzy

widelec
Posts: 4
Joined: Sun Jun 10, 2012 8:28 am

Re: GPS integration

Post by widelec »

Hi
your gps Works fine.
I'm too working on I2C gps. (I have SKG13C skylab gps module with Breakout board)
what I missed for upload sketch file to arduino nano v3 ?
thanks..
Attachments
skg13c.JPG
error.png

dr.tom
Posts: 141
Joined: Fri Mar 30, 2012 4:46 pm
Location: Croatia
Contact:

Re: GPS integration

Post by dr.tom »

Did you copy included files to your arduino library folder?

widelec
Posts: 4
Joined: Sun Jun 10, 2012 8:28 am

Re: GPS integration

Post by widelec »

Yes ,
but I want to be sure what is the exact file way?

twi.c and twi.c will be in the \arduino-1.0.1\libraries\Wire\utility right ?

gompf-2
Posts: 136
Joined: Sun Jun 05, 2011 11:46 am

Re: GPS integration

Post by gompf-2 »

Hi,
twi.c and twi.c will be in the \arduino-1.0.1\libraries\Wire\utility right ?

Yes, and copy the folders in "Arduino-PID-libs" to \arduino-1.0.1\libraries.
When you hover with the mouse over Sketch->Import Library you shoud find "APM_PI" and "PID_Controller" in the list.

I just tested EOSBandi´s i2c-gps-nav R33 code with the MTK3339. As my module came with 1Hz/9600baud I just had to add a few lines for init:

Code: Select all

void setup() {

  pinMode(8, OUTPUT);                  // led 
  //MTK3339 init
  delay(1000);                         // power on delay
  digitalWrite(8, HIGH);               // set the LED on
  Serial.begin(9600);                  // open port with firmware default baud
  Serial.println("$PMTK251,57600*2C"); // change baud
  Serial.end();
  //reconnect and blink
  digitalWrite(8, LOW);                // set the LED off
  delay(200);                          // wait for MTK3339 to settle at new baud
  digitalWrite(8, HIGH);               // set the LED on
  Serial.begin(57600);             
  Serial.println("$PMTK313,0*2F");     // disable sbas (>5Hz)
  Serial.println("$PMTK220,100*2F");   // set update frequ 10Hz
  digitalWrite(8, LOW);                // set the LED off
 
  uint8_t i;

  //Serial.begin(115200);

  //Init i2c_dataset;

If you remove the led-code you have to keep the delays.

I tested the serial rx (baud change/nmea update rate change) and the AVR gets "fixed" state, i2c conversion not tested now but as I didn´t alter anything here it shoud be fine. Will be in the air when compass arrives, don´t want to rip up the copter now.

Regards,
gompf

flyrobot
Posts: 73
Joined: Thu Apr 05, 2012 3:59 pm

Re: GPS integration

Post by flyrobot »

widelec wrote:Yes ,
but I want to be sure what is the exact file way?

twi.c and twi.c will be in the \arduino-1.0.1\libraries\Wire\utility right ?

hi widelec,

if you fail compiling with 1.0.1, try using 1.0

john

gompf-2
Posts: 136
Joined: Sun Jun 05, 2011 11:46 am

Re: GPS integration

Post by gompf-2 »

Hi,

yes you´re right, flyrobot. I tried it with 1.01 the same way as it works with 1.0 and it fails, too. If you fix the APM_PI lib folder you`ll get errors from twi/wire.cpp. -> use 1.0

mahowik
Posts: 332
Joined: Sun Apr 10, 2011 6:26 pm

Re: GPS integration

Post by mahowik »

gompf-2 wrote:Hi,
twi.c and twi.c will be in the \arduino-1.0.1\libraries\Wire\utility right ?

Yes, and copy the folders in "Arduino-PID-libs" to \arduino-1.0.1\libraries.
When you hover with the mouse over Sketch->Import Library you shoud find "APM_PI" and "PID_Controller" in the list.

I just tested EOSBandi´s i2c-gps-nav R33 code with the MTK3339. As my module came with 1Hz/9600baud I just had to add a few lines for init:

Code: Select all

void setup() {

  pinMode(8, OUTPUT);                  // led 
  //MTK3339 init
  delay(1000);                         // power on delay
  digitalWrite(8, HIGH);               // set the LED on
  Serial.begin(9600);                  // open port with firmware default baud
  Serial.println("$PMTK251,57600*2C"); // change baud
  Serial.end();
  //reconnect and blink
  digitalWrite(8, LOW);                // set the LED off
  delay(200);                          // wait for MTK3339 to settle at new baud
  digitalWrite(8, HIGH);               // set the LED on
  Serial.begin(57600);             
  Serial.println("$PMTK313,0*2F");     // disable sbas (>5Hz)
  Serial.println("$PMTK220,100*2F");   // set update frequ 10Hz
  digitalWrite(8, LOW);                // set the LED off
 
  uint8_t i;

  //Serial.begin(115200);

  //Init i2c_dataset;

If you remove the led-code you have to keep the delays.

I tested the serial rx (baud change/nmea update rate change) and the AVR gets "fixed" state, i2c conversion not tested now but as I didn´t alter anything here it shoud be fine. Will be in the air when compass arrives, don´t want to rip up the copter now.

Regards,
gompf


Hi gompf,

Why you disable sbas? as I know it gives more precise for 3339...

Also it seems you forgot about disable/enable necessary NMEA_OUTPUT (GGA, GSA and RMC frames)

Code: Select all

Serial.println("$PMTK314,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29");


Here is full solution:
1. for i2c GPS viewtopic.php?f=8&t=649&start=610#p14024 (note: there not correct comments, but code is ok)
2. for serial GPS viewtopic.php?f=8&t=649&start=880#p15369

thx-
Alex

User avatar
EOSBandi
Posts: 802
Joined: Sun Jun 19, 2011 11:32 am
Location: Budapest, Hungary
Contact:

Re: GPS integration

Post by EOSBandi »

SBAS works only up to 5Hz. It's worth a test to check which one is better. 10Hz with filter or 5Hz unfiltered with SBAS...

Sharkcopter
Posts: 21
Joined: Fri Feb 24, 2012 3:12 pm

Re: GPS integration

Post by Sharkcopter »

Hi
Is it the same to change parameters in the Gps module using MiniGps 1.7.1 or I must to change using PowerFlash ?
Another question, I note that connecting to Gps FTDI using RX/TX crossed cable I can read NEMEA sentences but I can not change parameters, if I want to change parameters I have to flash before with "Blink" schetch, is it correct ?
Thanks in advance

gompf-2
Posts: 136
Joined: Sun Jun 05, 2011 11:46 am

Re: GPS integration

Post by gompf-2 »

@mahowik
Sorry for double posting the info, I didn´t find your post ... was blind.
EOSBandi is right about the SBAS, the NMEA_OUTPUT is fine by default with the installed firmware so I don´t change anything here. So sad that "LOCUS" is fixed at a sample period of 15s...
@Sharkcopter
To change parameters at runtime you can use MiniGPS and press ctrl+alt+s to enable setup mode. This "ctrl+alt+s" cost me a day until I found this hint;-) Changes will be lost if backup voltage is gone. New fixed power on defaults can be flashed with new firmware only but I didn´touch this now (there is a 5hz/38400baud FW for the 3339).
The adafruit gps tutorial and lib are nice lecture.
Regards,
gompf

Sharkcopter
Posts: 21
Joined: Fri Feb 24, 2012 3:12 pm

Re: GPS integration

Post by Sharkcopter »

gompf-2 wrote:@Sharkcopter
To change parameters at runtime you can use MiniGPS and press ctrl+alt+s to enable setup mode. This "ctrl+alt+s" cost me a day until I found this hint;-) Changes will be lost if backup voltage is gone. New fixed power on defaults can be flashed with new firmware only but I didn´touch this now (there is a 5hz/38400baud FW for the 3339).
The adafruit gps tutorial and lib are nice lecture.
Regards,
gompf

Thanks gompf-2
Now I understood that MiniGps change parameters only at runtime and if I need to have this at new power-on I have to use Powerflash and flash Gps with new firmware.

Scotth72
Posts: 23
Joined: Sat Jan 21, 2012 4:11 am

Re: GPS integration

Post by Scotth72 »

EOSBandi wrote:SBAS works only up to 5Hz. It's worth a test to check which one is better. 10Hz with filter or 5Hz unfiltered with SBAS...


I used MiniGPS 1.7 after flashing to 10hz firmware on 3329 chip. I was able to enable SBAS and keep 10hz. At least it said it did. Am I missing something?

User avatar
EOSBandi
Posts: 802
Joined: Sun Jun 19, 2011 11:32 am
Location: Budapest, Hungary
Contact:

Re: GPS integration

Post by EOSBandi »

Scotth72 wrote:
EOSBandi wrote:SBAS works only up to 5Hz. It's worth a test to check which one is better. 10Hz with filter or 5Hz unfiltered with SBAS...


I used MiniGPS 1.7 after flashing to 10hz firmware on 3329 chip. I was able to enable SBAS and keep 10hz. At least it said it did. Am I missing something?

According to the datasheet DGPS is supported max 5Hz, we have to test, perhaps a new firmware changed this restriction.

Scotth72
Posts: 23
Joined: Sat Jan 21, 2012 4:11 am

Re: GPS integration

Post by Scotth72 »

EOSBandi wrote:
Scotth72 wrote:
EOSBandi wrote:SBAS works only up to 5Hz. It's worth a test to check which one is better. 10Hz with filter or 5Hz unfiltered with SBAS...


Ok. I am currently using the gps with a extra ProMini for an I2C GPS. Works well, even in some wind, on both my Tri and Quad. I wonder, if the datasheet is correct, which part is not working correctly? The 10hz or WAAS?
The older MiniGPS, 1.4, would only allow 5hz update rate. 1.7 will allow both 10hz and WAAS input, and shows the update has been accepted. I hope its correct.

Sharkcopter
Posts: 21
Joined: Fri Feb 24, 2012 3:12 pm

Re: GPS integration

Post by Sharkcopter »

Hi, I need your help
I cannot flash Gps with PowerFlash.
First of all I flashed Atmega 328 on the navigatron V2 with a "Blink" sketch.
Second I have crossed TX/RX on FTDI cable.
I am able to see NEMEA Sentences and I can change parameters with MiniGps, but when I try to flash Gps using PowerFlash it give me an error:
[Flash Download]
Fail!!(Download) BROM_CMD_START_FAIL
[Finish]
Take(4) secs to test.
Has someone an idea ?
Thanks in advance
Last edited by Sharkcopter on Mon Jun 11, 2012 10:11 pm, edited 1 time in total.

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

Re: GPS integration

Post by dramida »

Must see: 15 minutes of filming in fast forward, straight up, of GPS POS HOLD tricopter, 10 Hz serial GPS on Crius SE on 28 may 2012 dev version.

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

Y.Mita
Posts: 46
Joined: Thu Sep 15, 2011 11:25 pm

Re: GPS integration

Post by Y.Mita »

At r33, we can configure Position hold/Position rate/Navigation PID using LCD.
From MultiWii20120528, MultiWii20120606, it seems deleted. Why?
I hope its come back! Thanks!

Vilhelmsson
Posts: 8
Joined: Sun May 20, 2012 7:09 am

Re: GPS integration

Post by Vilhelmsson »

Sharkcopter wrote:Hi, I need your help
I cannot flash Gps with PowerFlash.
First of all I flashed Atmega 328 on the navigatron V2 with a "Blink" sketch.
Second I have crossed TX/RX on FTDI cable.
I am able to see NEMEA Sentences and I can change parameters with MiniGps, but when I try to flash Gps using PowerFlash it give me an error:
[Flash Download]
Fail!!(Download) BROM_CMD_START_FAIL
[Finish]
Take(4) secs to test.
Has someone an idea ?
Thanks in advance


Had the same probs yesterday and my fix was restart Windows, som howe the ports get blocked, this is for W7/32 :twisted:

Sharkcopter
Posts: 21
Joined: Fri Feb 24, 2012 3:12 pm

Re: GPS integration

Post by Sharkcopter »

Vilhelmsson wrote:
Sharkcopter wrote:Hi, I need your help
I cannot flash Gps with PowerFlash.
First of all I flashed Atmega 328 on the navigatron V2 with a "Blink" sketch.
Second I have crossed TX/RX on FTDI cable.
I am able to see NEMEA Sentences and I can change parameters with MiniGps, but when I try to flash Gps using PowerFlash it give me an error:
[Flash Download]
Fail!!(Download) BROM_CMD_START_FAIL
[Finish]
Take(4) secs to test.
Has someone an idea ?
Thanks in advance

Had the same probs yesterday and my fix was restart Windows, som howe the ports get blocked, this is for W7/32 :twisted:

Solved, the problem was :
Melih from Flytron said that Navigatron V2 works well with 3.3V and 5V, that is right but if I need to flash firmare into Gps I must use only 3.3V FTDI.
Conversely, if I need to flash Atmega328 on board Navigatron V2 I must use only 5V FTDI.
I can read and change data from Gps using MiniGps with 3.3V and 5V FTDI.
I do not know if this only happens in my Navigatron V2 board or is the same thing for all boards.
Now i flashed Gps firmware following EOSbandi instructions but the sentences that I can see with MiniGps are CGA/GSA/RMC/VTG and not only CGA/GSA and RMC is it correct ?

Mac9
Posts: 45
Joined: Thu Oct 20, 2011 2:47 pm
Contact:

Re: GPS integration

Post by Mac9 »

My problem is most probable Arduino and its USBasp drivers but I will ask the question hear in the hope that some one will take pity on a hair less old man. I have pulled it all out trying to solve this problem. I am trying to update the firmware of both the GPS and on board Processor of my Ffytron I2C GPS module. I seem to be failing at the first hurdle.The problem is I have a Hobby king USBasp programmer that works great with KK stuff. The drivers are all up to date and are recognised "plug and play" by my Win 7 64 bit laptop and also by my 32 bit desk top. I have wired MOSI, MISO,gnd,Vcc, and SCK to my Flytron Navigatron V1, the one with the supper capacitor. I have set the following in Version 1.0 Arduino environment tools : Programmer USBasp, board all the Mega 328 each in turn. In every case I get a "not in sync error" when I try and down load the Blink sketch. I have even tried configuring a Arduino Uni as a ISP programmer but that's a whole new bag of worms.
Help

Please

Regards

John

dr.tom
Posts: 141
Joined: Fri Mar 30, 2012 4:46 pm
Location: Croatia
Contact:

Re: GPS integration

Post by dr.tom »

try my paper mod if you can't get rid of 'out of sync error message'

Image


viewtopic.php?f=8&t=649&p=14137&hilit=paper#p14135

as I flashed my module a lot, didn't want to desolder/solder the gps every time...
I left the upper piece of paper there and soldered the VCC pin via some wire to a servo plug,
so I just unplug it when I flash flytron, it works great. 8-)

viewtopic.php?f=9&t=1696

widelec
Posts: 4
Joined: Sun Jun 10, 2012 8:28 am

Re: GPS integration

Post by widelec »

@gompf-2
@flyrobot
Thanks, solved
Arduino version is problem. library update working only arduino 1.0


flyrobot wrote:
widelec wrote:Yes ,
but I want to be sure what is the exact file way?

twi.c and twi.c will be in the \arduino-1.0.1\libraries\Wire\utility right ?

hi widelec,

if you fail compiling with 1.0.1, try using 1.0

john

Tazzy
Posts: 75
Joined: Sun Jun 19, 2011 4:45 pm
Location: Sweden

Re: GPS integration

Post by Tazzy »

Thanks all folks that have made gps function possibly so fast !
I have a almost perfect gps hold now after some minor pid adjustments but i need to ask if it isn't possibly to do gps lock and alt lock and just yaw around ?
If i try that the copter drop position hold and try to fly away lol is this a pid problem that i can adjust or is it a bug or an hidden function ;) in the software?
The yaw and alt hold works perfect but not if pos lock is activated.

Regards Tazzy

User avatar
EOSBandi
Posts: 802
Joined: Sun Jun 19, 2011 11:32 am
Location: Budapest, Hungary
Contact:

Re: GPS integration

Post by EOSBandi »

Tazzy wrote:Thanks all folks that have made gps function possibly so fast !
I have a almost perfect gps hold now after some minor pid adjustments but i need to ask if it isn't possibly to do gps lock and alt lock and just yaw around ?
If i try that the copter drop position hold and try to fly away lol is this a pid problem that i can adjust or is it a bug or an hidden function ;) in the software?
The yaw and alt hold works perfect but not if pos lock is activated.

Regards Tazzy


R u sure that your MAG is working correctly ? Can you fly in headfree mode ?

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

Re: GPS integration

Post by dramida »

I observed same problem here also. If i use YAW let's say, more than 90 degrees of rotation, the copter momentary looses the ability to hold its position. The mag works rock solid.
Also i noticed that the leaning of the copter is also rotated as copter rotates, and so the momentary adjustments are applied in wrong direction. Consequently, if i keep rotating on yaw, the copter is all over the sky.
If we could get solid gps hold when rotating, we could make great aerial panoramas.

Tazzy
Posts: 75
Joined: Sun Jun 19, 2011 4:45 pm
Location: Sweden

Re: GPS integration

Post by Tazzy »

EOSBandi wrote:
Tazzy wrote:Thanks all folks that have made gps function possibly so fast !
I have a almost perfect gps hold now after some minor pid adjustments but i need to ask if it isn't possibly to do gps lock and alt lock and just yaw around ?
If i try that the copter drop position hold and try to fly away lol is this a pid problem that i can adjust or is it a bug or an hidden function ;) in the software?
The yaw and alt hold works perfect but not if pos lock is activated.

Regards Tazzy


R u sure that your MAG is working correctly ? Can you fly in headfree mode ?


Yes i can fly in headfree mode and my mag is ok, it is exactly as dramida says .... its all over the place after some yaw lol
Position hold works perfect and return to home saved my ass last night when i lost orientation in low light lol
Im going to get my apc220 serial link on it so i can log whats happening asap but i have alot of work right now ....

// Tazzy

User avatar
EOSBandi
Posts: 802
Joined: Sun Jun 19, 2011 11:32 am
Location: Budapest, Hungary
Contact:

Re: GPS integration

Post by EOSBandi »

I browsed through the code again, an I think found a possible issue. Mag reading and GPS reading is decoupled by a simple task scheduler here :

Code: Select all

    static uint8_t taskOrder=0; // never call all functions in the same loop, to avoid high delay spikes
    switch (taskOrder++ % 5) {
      case 0:
        #if MAG
          Mag_getADC();
        #endif
        break;
      case 1:
        #if BARO
          Baro_update();
        #endif
        break;
      case 2:
        #if BARO
          getEstimatedAltitude();
        #endif
        break;
      case 3:
        #if GPS
          GPS_NewData();
        #endif
        break;
      case 4:
        #if SONAR
          Sonar_update();debug3 = sonarAlt;
        #endif
        break;
    }


I think this cause the poshold instability during yaw. (it is explains also why poshold is working again when we stop yawing). So for a quick test, could somebody test this mod.? (I'm grounded due bad weather)

Code: Select all

    switch (taskOrder++ % 5) {
      case 0:
        #if MAG
          Mag_getADC();
        #endif
        break;
      case 1:
        #if BARO
          Baro_update();
        #endif
        break;
      case 2:
        #if BARO
          getEstimatedAltitude();
        #endif
        break;
      case 3:
        #if MAG
          Mag_getADC();
        #endif
        #if GPS
          GPS_NewData();
        #endif
       
        break;
      case 4:
        #if SONAR
          Sonar_update();debug3 = sonarAlt;
        #endif
        break;
    }

Mac9
Posts: 45
Joined: Thu Oct 20, 2011 2:47 pm
Contact:

Re: GPS integration

Post by Mac9 »

Ref Problems with out of sync error Flytron ver 1 Navigatron
Dr Tom,
Thanks for that but my problem is not the flashing of the GPS I haven't got that far, its a problem with uploading the Blink sketch in order to start the flashing.

Regards

John

User avatar
EOSBandi
Posts: 802
Joined: Sun Jun 19, 2011 11:32 am
Location: Budapest, Hungary
Contact:

Re: GPS integration

Post by EOSBandi »

fastsonic wrote:Hi@all
can somebody help me to activate my GPS. :(
My story:
No Plan of Flashing, Arduino, Coding, Multii, only RC Helicopter and Planes..
Many Hours to Read about Multiwii,Arduino, Flashing, Buspirat,I2C, WINAVR, Hexefiles......
Sometimes hate it, somtimes happy like a kind when the Right LED blining.... and the TRI fly.
Hardware:
TRI
Crius SE.
New Baro MS561101BA
After Problems with the MAgnetic field i remove the Sensor from board an bring it onto the second higher Board .
This Second board is an Rushduino GPS with I2C.

NO I2C Errors All works fine after all the time..
But the GPS :(
I flash this one with an Buspirate directly on the 6Pinhead. I learnd a lot over this Buspirat. For two Week i know nothing ...
I use arduino to create the HEX File and flash the GPS:

avrdude -c buspirate -P com5 -p atmega328p -U flash:w:NAV.hex

Seems to be OK no Errors.
I found a second way to make configfile in Arduino to use the Buspirate directly. Also seems to be OK...
HEXFile is uploadet can somebody check it ?
It there a way to check the working Programm on the GPS ?
I can use the Buspirat as I2C reader ( also for 2 weeks no info about this)
I have one time an Error and try the Board with Error but then i become a lot of I2C Errors. Flash new an no i2C Errors but also no Fix ore something in the GUI
I try the Multiwii 04.05 and the 28.05 and the Multiwii in the Package R33
The Rushduinoboard have an SAT Fix but GUI still without GPS
in config.h i use the i2cGPS option and deactivate the seriell. is there somthing i must check? the Adress on the Multwiiside ?
Have anybody an tip for me.
Sorry for the Long Text and the Bad English..
Also PN´s ore Emails are Welcome.
Regards from Germany
Fastsonic

Weird, why do you use a buspirate ? Whi not a ftdi blob?
Did you try to flash a blink sketch to the i2cgps module with this buspirate method ? Is it works correctly ?

If you have a buspirate then you can query the registesrs from the i2cgps, do you got valid values ?

EosBandi

Tazzy
Posts: 75
Joined: Sun Jun 19, 2011 4:45 pm
Location: Sweden

Re: GPS integration

Post by Tazzy »

EOSBandi wrote:I browsed through the code again, an I think found a possible issue. Mag reading and GPS reading is decoupled by a simple task scheduler here :

Code: Select all

    static uint8_t taskOrder=0; // never call all functions in the same loop, to avoid high delay spikes
    switch (taskOrder++ % 5) {
      case 0:
        #if MAG
          Mag_getADC();
        #endif
        break;
      case 1:
        #if BARO
          Baro_update();
        #endif
        break;
      case 2:
        #if BARO
          getEstimatedAltitude();
        #endif
        break;
      case 3:
        #if GPS
          GPS_NewData();
        #endif
        break;
      case 4:
        #if SONAR
          Sonar_update();debug3 = sonarAlt;
        #endif
        break;
    }


I think this cause the poshold instability during yaw. (it is explains also why poshold is working again when we stop yawing). So for a quick test, could somebody test this mod.? (I'm grounded due bad weather)

Code: Select all

    switch (taskOrder++ % 5) {
      case 0:
        #if MAG
          Mag_getADC();
        #endif
        break;
      case 1:
        #if BARO
          Baro_update();
        #endif
        break;
      case 2:
        #if BARO
          getEstimatedAltitude();
        #endif
        break;
      case 3:
        #if MAG
          Mag_getADC();
        #endif
        #if GPS
          GPS_NewData();
        #endif
       
        break;
      case 4:
        #if SONAR
          Sonar_update();debug3 = sonarAlt;
        #endif
        break;
    }


Eosbandi Sorry but im no coder ;) i fly dev 20120606 and the code don't look exactly like that what version was your code from ?
my look like this tell me what to change and i will try it .....
-----------------------
static uint8_t taskOrder=0; // never call all functions in the same loop, to avoid high delay spikes
switch (taskOrder++ % 5) {
case 0:
#if MAG
Mag_getADC();
#endif
break;
case 1:
#if BARO
Baro_update();
#endif
break;
case 2:
#if BARO
getEstimatedAltitude();
#endif
break;
case 3:
#if GPS
if(GPS_Enable) GPS_NewData();
#endif
break;
case 4:
#if SONAR
Sonar_update();debug3 = sonarAlt;
#endif
#ifdef LANDING_LIGHTS_DDR
auto_switch_landing_lights();
#endif
break;
------------------------------------
// Tazzy

dr.tom
Posts: 141
Joined: Fri Mar 30, 2012 4:46 pm
Location: Croatia
Contact:

Re: GPS integration

Post by dr.tom »

Mac9 wrote:Ref Problems with out of sync error Flytron ver 1 Navigatron
Dr Tom,
Thanks for that but my problem is not the flashing of the GPS I haven't got that far, its a problem with uploading the Blink sketch in order to start the flashing.

Regards

John



just try it, I also had out of sync problems and couldn't even flash the blink code....
but with that mod, I was able to flash the atmega with blink, and then the gps chipset itself...
didn't had time to inspect why and where, but just wanted to go out and fly, it worked for me :)

User avatar
EOSBandi
Posts: 802
Joined: Sun Jun 19, 2011 11:32 am
Location: Budapest, Hungary
Contact:

Re: GPS integration

Post by EOSBandi »

No prob. JUst move the MAG_getADC() before to GPS_NewData() like this : (It's not a patch just trying to find out the root of the problem)

Code: Select all

static uint8_t taskOrder=0; // never call all functions in the same loop, to avoid high delay spikes
    switch (taskOrder++ % 5) {
      case 0:
        #if MAG
          Mag_getADC();
        #endif
        break;
      case 1:
        #if BARO
          Baro_update();
        #endif
        break;
      case 2:
        #if BARO
          getEstimatedAltitude();
        #endif
        break;
      case 3:
        #if GPS
          Mag_getADC();
          if(GPS_Enable) GPS_NewData();
        #endif
        break;
      case 4:
        #if SONAR
          Sonar_update();debug3 = sonarAlt;
        #endif
        #ifdef LANDING_LIGHTS_DDR
          auto_switch_landing_lights();
        #endif
        break;

Y.Mita
Posts: 46
Joined: Thu Sep 15, 2011 11:25 pm

Re: GPS integration

Post by Y.Mita »

Y.Mita wrote:At r33, we can configure Position hold/Position rate/Navigation PID using LCD.
From MultiWii20120528, MultiWii20120606, it seems deleted. Why?
I hope its come back! Thanks!

Solved by myself.
to LCD.ino add below to line #700,

Code: Select all

#if GPS
PROGMEM prog_char lcd_param_text90 [] = "GPS Pos. P";
PROGMEM prog_char lcd_param_text91 [] = "GPS Pos. I";
PROGMEM prog_char lcd_param_text92 [] = "Pos Rate P";
PROGMEM prog_char lcd_param_text93 [] = "Pos Rate I";
PROGMEM prog_char lcd_param_text94 [] = "Pos Rate D";
PROGMEM prog_char lcd_param_text95 [] = "NAV Rate P";
PROGMEM prog_char lcd_param_text96 [] = "NAV Rate I";
PROGMEM prog_char lcd_param_text97 [] = "NAV Rate D";
#endif

add below just before line #777, before "#ifdef LCD_CONF_AUX"

Code: Select all

#if GPS
 &lcd_param_text90, &conf.P8[PIDPOS] , &__RC,
 &lcd_param_text91, &conf.I8[PIDPOS] , &__I,
 &lcd_param_text92, &conf.P8[PIDPOSR], &__P,
 &lcd_param_text93, &conf.I8[PIDPOSR], &__RC,   
 &lcd_param_text94, &conf.D8[PIDPOSR], &__RC,
 &lcd_param_text95, &conf.P8[PIDNAVR], &__P,
 &lcd_param_text96, &conf.I8[PIDNAVR], &__RC,
 &lcd_param_text97, &conf.D8[PIDNAVR], &__RC,
#endif

sorry, but I only test on FlyduinoMEGA, not on Arduino pro mini. May be memory size over at ATmega328.

Tazzy
Posts: 75
Joined: Sun Jun 19, 2011 4:45 pm
Location: Sweden

Re: GPS integration

Post by Tazzy »

EOSBandi wrote:No prob. JUst move the MAG_getADC() before to GPS_NewData() like this : (It's not a patch just trying to find out the root of the problem)

Code: Select all

static uint8_t taskOrder=0; // never call all functions in the same loop, to avoid high delay spikes
    switch (taskOrder++ % 5) {
      case 0:
        #if MAG
          Mag_getADC();
        #endif
        break;
      case 1:
        #if BARO
          Baro_update();
        #endif
        break;
      case 2:
        #if BARO
          getEstimatedAltitude();
        #endif
        break;
      case 3:
        #if GPS
          Mag_getADC();
          if(GPS_Enable) GPS_NewData();
        #endif
        break;
      case 4:
        #if SONAR
          Sonar_update();debug3 = sonarAlt;
        #endif
        #ifdef LANDING_LIGHTS_DDR
          auto_switch_landing_lights();
        #endif
        break;


Nope sorry to say it did not work it did take off now also i think ;) i have quite hard winds here right now but the pos hold works ok so i suppose it would work even with wind.

// Tazzy

User avatar
EOSBandi
Posts: 802
Joined: Sun Jun 19, 2011 11:32 am
Location: Budapest, Hungary
Contact:

Re: GPS integration

Post by EOSBandi »

Tazzy wrote:Nope sorry to say it did not work it did take off now also i think ;) i have quite hard winds here right now but the pos hold works ok so i suppose it would work even with wind.

// Tazzy


You mean, you tested it and the behaviour did not changed, when you yaws it looses positon?
When you stop yawing, it will regain position ?

Tazzy
Posts: 75
Joined: Sun Jun 19, 2011 4:45 pm
Location: Sweden

Re: GPS integration

Post by Tazzy »

EOSBandi wrote:
Tazzy wrote:Nope sorry to say it did not work it did take off now also i think ;) i have quite hard winds here right now but the pos hold works ok so i suppose it would work even with wind.

// Tazzy


You mean, you tested it and the behaviour did not changed, when you yaws it looses positon?
When you stop yawing, it will regain position ?


Yes it looses the position and did take off in high speed from me i did not have the guts to see if it was going to regain the position because of my small air field ;) so i did bring it back with stick manually with pos hold ON all the time and then it calm down in position again.

User avatar
EOSBandi
Posts: 802
Joined: Sun Jun 19, 2011 11:32 am
Location: Budapest, Hungary
Contact:

Re: GPS integration

Post by EOSBandi »

Tazzy wrote:
EOSBandi wrote:
Tazzy wrote:Nope sorry to say it did not work it did take off now also i think ;) i have quite hard winds here right now but the pos hold works ok so i suppose it would work even with wind.

// Tazzy


You mean, you tested it and the behaviour did not changed, when you yaws it looses positon?
When you stop yawing, it will regain position ?


Yes it looses the position and did take off in high speed from me i did not have the guts to see if it was going to regain the position because of my small air field ;) so i did bring it back with stick manually with pos hold ON all the time and then it calm down in position again.


Okay
Just for reference, what sensor board are you unsing, and what is the orientation of your board....
(trying to collect as mutch info as possible)

Tazzy
Posts: 75
Joined: Sun Jun 19, 2011 4:45 pm
Location: Sweden

Re: GPS integration

Post by Tazzy »

gy-86 default orientation and i2c gps with a second 328p

Post Reply