Page 11 of 35

Re: GPS integration

Posted: Wed May 02, 2012 3:48 pm
by KeesvR
I think my GPS is not working anymore.
So I can't test anymore.

Re: GPS integration

Posted: Wed May 02, 2012 4:19 pm
by MelihK
EOSBandi wrote:Guys, I need a little help. Honestly vector algebra and trigonometrics are not my favourite topics, and I'm stuck with a final step of poshold implementation..


Good News: I'm writing GPS position and LOS calculation codes since years because of SimpleOSD(I'm the designer). I have alot of code part and experience about fast sin/cosin calculations and heading.
Bad News: Now I'm in the winter house(in the city center) and finding a test place is impossible for me. I'm planning to go to summer house in 4 weeks and i will help about coding :)

Cheers
Melih

Re: GPS integration

Posted: Wed May 02, 2012 5:12 pm
by Katch
Can someone post a summary of what behaviour to expect while testing the i2c GPS code please?

I've just installed a Flytron i2c on my Warthox MWC with Free IMU 0.3.5.MS.

My headfree mode is working nicely and I get a 3D fix on my GPS.

At the moment when I turn on POS hold the Quad goes off on a little adventure way over there somewhere.

Haven't tested RTH but I understand I should expect the quad to strafe the sh*t out of me and then go for a little adventure way over there somewhere.

Is this basically where we are at right now with the latest dev code.

Re: GPS integration

Posted: Wed May 02, 2012 6:59 pm
by EOSBandi
Katch wrote:Can someone post a summary of what behaviour to expect while testing the i2c GPS code please?

I've just installed a Flytron i2c on my Warthox MWC with Free IMU 0.3.5.MS.

My headfree mode is working nicely and I get a 3D fix on my GPS.

At the moment when I turn on POS hold the Quad goes off on a little adventure way over there somewhere.

Haven't tested RTH but I understand I should expect the quad to strafe the sh*t out of me and then go for a little adventure way over there somewhere.

Is this basically where we are at right now with the latest dev code.


I recommend to wait a couple of days... I'll release a new gps code very soon. It seems that I managed to figured out the vector rotation. Will have a test fly tomorrow, then publish...

Re: GPS integration

Posted: Wed May 02, 2012 7:21 pm
by jevermeister
Eosbandi,
What are you trying to do?

If you want to implement poshold just copy alex code to have the same behavior for start.
If sou wwnt to code w better solution you have to control the approadhing speed as afunction of tilt angle.

Nils
Ps. I am in my summer house now and only uee my pad. I will try to help when I am back ih my lab - oh yes: The lab!!!

Re: GPS integration

Posted: Wed May 02, 2012 7:24 pm
by mbrak
hi andras

good news :)

will you release both (serial and i2c)?

some posts before i read that you develop the code on a mega2560 with serial gps :)
my copter has a 2560 with serial gps :)

we are waiting patiently :) :) :)

Re: GPS integration

Posted: Wed May 02, 2012 7:28 pm
by mbrak
offtopic on

summerhouse, winterhouse, lab......

whats going on here ? :)

have you won in the lottery? :)

offtopic off

Re: GPS integration

Posted: Wed May 02, 2012 7:40 pm
by jevermeister
mbrak wrote:offtopic on

summerhouse, winterhouse, lab......

whats going on here ? :)

have you won in the lottery? :)

offtopic off


The so called summer house is the old farm of my father in law. My lab is an underground lair with lots of spiders and stuff.

Sorry no lottery.

Nils

Re: GPS integration

Posted: Wed May 02, 2012 7:55 pm
by Katch
EOSBandi wrote:
Katch wrote:Can someone post a summary of what behaviour to expect while testing the i2c GPS code please?

I've just installed a Flytron i2c on my Warthox MWC with Free IMU 0.3.5.MS.

My headfree mode is working nicely and I get a 3D fix on my GPS.

At the moment when I turn on POS hold the Quad goes off on a little adventure way over there somewhere.

Haven't tested RTH but I understand I should expect the quad to strafe the sh*t out of me and then go for a little adventure way over there somewhere.

Is this basically where we are at right now with the latest dev code.


I recommend to wait a couple of days... I'll release a new gps code very soon. It seems that I managed to figured out the vector rotation. Will have a test fly tomorrow, then publish...


Will this require reprogramming the Arduino on the i2c GPS BoB?

Re: GPS integration

Posted: Wed May 02, 2012 7:57 pm
by PatrikE
Katch wrote:Will this require reprogramming the Arduino on the i2c GPS BoB?


Yepp...

Re: GPS integration

Posted: Wed May 02, 2012 8:05 pm
by EOSBandi
jevermeister wrote:Eosbandi,
What are you trying to do?

If you want to implement poshold just copy alex code to have the same behavior for start.
If sou wwnt to code w better solution you have to control the approadhing speed as afunction of tilt angle.



Well,
I'm porting this http://code.google.com/p/arducopter/wiki/AC2_loiter_PID which is a proven method, and most of the code is available in arduino format. Almost finished...

Re: GPS integration

Posted: Wed May 02, 2012 9:07 pm
by jevermeister
Hey Andras,
That is exactly what I wm talking about.cool. I tried to export the mikrokopter code but hwd problems importing it into the code.

Andras,if you need help or ideas,please contact me. I am very interested in helping you.

Nils

Re: GPS integration

Posted: Thu May 03, 2012 1:39 pm
by dr.tom
I know you are doing a great job and putting a lot of effort, thank you all.
here's just a thought, when you are already taking GPS speeds into equations of rth...

it would be nice if in upcoming config or gps section of the code, we could define some things if needed
- max ground speed of rth function (if we don't need to come fast from far away, but rather calm speed)
- facing the model to rth point while returning, now it stays oriented as it was, only tilts to home, doesn't turn
(would be better for AP and FPV use)

Re: GPS integration

Posted: Thu May 03, 2012 1:50 pm
by Bledi
an other factor that is look interesting for secure is the altimeter for return to home.
if we use return to home is often because we are at long distance so we need to come back without going into a tree. By putting a min altitude for the return to home in secure conditions.

Re: GPS integration

Posted: Thu May 03, 2012 2:18 pm
by EOSBandi
Bledi wrote:an other factor that is look interesting for secure is the altimeter for return to home.
if we use return to home is often because we are at long distance so we need to come back without going into a tree. By putting a min altitude for the return to home in secure conditions.


First : Stable poshold.
Second : Rate based, cross track corrected RTH
All others after these two...

Re: GPS integration

Posted: Thu May 03, 2012 2:29 pm
by Bledi
+1 :)

Re: GPS integration

Posted: Thu May 03, 2012 3:35 pm
by shikra
+1 too!!
Nice work EOS

Re: GPS integration

Posted: Thu May 03, 2012 9:18 pm
by EOSBandi
OK Folks,

I can not hold it back anymore, here is a work-in-progress http://code.google.com/p/multiwii-gps-work/
release. It's a vanilia MultiWii 2.0 codebase for SERIAL GPS ONLY with the following changes:
-Improved mag calibration. It's crucial to have a dead on compass for gps nav. Alex did a great work on simplifying the mag gain and offset calibration, but it also added some non-linearity.
-Added magnetic decliniation to the heading. You can set it at the beginning of the MultiWii.ino
-Raised resolution of the gps coordinates to 1deg = 10 000 000. I had bad experiences with the pervious lower resolution.
-Added a pos_hold PI and a pos_hold_rate PID controller. See description here : http://code.google.com/p/arducopter/wiki/AC2_loiter_PID
-Using PI and PID controller classes (they are in the libraries folder, copy them to arduino libraries folder)
Notes : PI and PID values are not wired out to the gui yet, you have to change them at the beginning of multiwii.ino.
It's a work in progress now, so i'm continously working on this code. You can try it if you really know what are you doing, please do not use it if you are not familiar with multiwii code. I know this code does not follow standard multiwii coding guidelines (for example using classes and libraries) and not optimalised, so please do not complain for these.
And finally, I do not believe that this code will fit into a 328, so please use 1280 or 2560 based boards for testing.
Once the code is stabilised (more or less) i'll put it to the i2c_gps codebase...

Re: GPS integration

Posted: Thu May 03, 2012 9:53 pm
by Gaijin
No complaints, thanks for working on it all. :ugeek:

I look forward to testing the I2C version when you are finished, keep up the good work

Re: GPS integration

Posted: Thu May 03, 2012 10:49 pm
by copterrichie
Is there a safe way to ground test these new features? I am in the process of building a new copter with a 1280 but it is not totally ready yet or that I would trust for GPS flight testing. I really would like to help out if possible.

Re: GPS integration

Posted: Fri May 04, 2012 8:33 pm
by LuFa
Hi EOSBandi ,

Today i have test your GPS code :)
but i think there is a proplem into yout code .
After Switch On GPS Position Hold all is ok , but after ~ 20 - 30 sek. the Copter make a Flip :(
I have make around 10 Flights , and 9 of tham End with a Flip after turn On Gps .
The Onetime where the copter makes no Flip was the Firt Flight .
But without Flip , the GPS Wokrs very great !

Im not 100% shure that is it a proplem of your code , its also possible that is it a proplem of my Hardware .

My Setup Is :

QuadX
Multiwii 2.0 Processing Gui
Standart Reveiver
Flyduino Mega
Mediatek GPS with 9600bd
MS5611
ITG3200
HMC5843
ADXL345

GPS is Connect to Serial Port 3 .
PID and Pi Parameter from GPS are default ;)

Re: GPS integration

Posted: Fri May 04, 2012 10:40 pm
by EOSBandi
LuFa wrote:Hi EOSBandi ,

Today i have test your GPS code :)
but i think there is a proplem into yout code .
After Switch On GPS Position Hold all is ok , but after ~ 20 - 30 sek. the Copter make a Flip :(
I have make around 10 Flights , and 9 of tham End with a Flip after turn On Gps .
The Onetime where the copter makes no Flip was the Firt Flight .
But without Flip , the GPS Wokrs very great !

Im not 100% shure that is it a proplem of your code , its also possible that is it a proplem of my Hardware .

My Setup Is :

QuadX
Multiwii 2.0 Processing Gui
Standart Reveiver
Flyduino Mega
Mediatek GPS with 9600bd
MS5611
ITG3200
HMC5843
ADXL345

GPS is Connect to Serial Port 3 .
PID and Pi Parameter from GPS are default ;)


Exactly how do you describe the "flip" ? The GPS code indiced banking is limited to +/- 20deg. So it could not lead to a flip, but could look like an agressive bank.
However it's recommended to use the gps at least 5Hz update rate (10Hz is better) which requires 57kbaud or 112.2K speed.
1Hz is definitely a no go... it throws the pid controller to the extremes.
You can try to limit further the GPS banking by modifying this line in the gps.pde
#define NAV_BANK_MAX 2000
100 = 1deg

Re: GPS integration

Posted: Sat May 05, 2012 10:11 am
by ygl611
Hi EOSBandi

Just tested you new GPS code, "GPS Position Hold"function wokes very great! no flip.
Thanks your wonderful work.
Next step I will test "GO home"function.
BTW, I can say that your code runs on the M328 board very well with a serial 5 Hz Ulbox GPS, of course, "serialCom()" must be commented.

EDIT : "Go home" is also perfect.

Thanks EOSBandi again

Re: GPS integration

Posted: Sat May 05, 2012 12:43 pm
by flyrobot
Hi ygl611,

Can you share, what ublox gps do you use?

Thanks,
John

Re: GPS integration

Posted: Sat May 05, 2012 1:13 pm
by LuFa
can you tell me your PID Values ?
today i have found the Flipproplem :D it wars a bad cabel connection .

@ EosBandi , witch GPS Modul did you use ?

Re: GPS integration

Posted: Sat May 05, 2012 2:01 pm
by ygl611
flyrobot wrote:Hi ygl611,

Can you share, what ublox gps do you use?

Thanks,
John


I made the Ublox GPS board by myself, use the Ulbox chip NEO6M. GPS PID is defaut value

Re: GPS integration

Posted: Sat May 05, 2012 2:12 pm
by flyrobot
That is cool.

This gps was using by dji wkm and MK with very good result.

Do you plan to sell with mega 328 ?

John

Re: GPS integration

Posted: Sat May 05, 2012 3:42 pm
by Quad FRITZ
Hello-

Does anybody know how to change the GPS refresh rate of a NAVIGATRON I2C GPS module?
I really would love to test the serial GPS Dev Version of EOSbandi but also see no point in trying this with a refresh rate of 1Hz.
The module should be able to output a 10 Hz position signal.

Thanks and have a nice weekend
Roman

Re: GPS integration

Posted: Sat May 05, 2012 4:23 pm
by EOSBandi
Quad FRITZ wrote:Hello-

Does anybody know how to change the GPS refresh rate of a NAVIGATRON I2C GPS module?
I really would love to test the serial GPS Dev Version of EOSbandi but also see no point in trying this with a refresh rate of 1Hz.
The module should be able to output a 10 Hz position signal.

Thanks and have a nice weekend
Roman

Current dev is serial gps only.... i2c is still the old code.... stay tuned for the i2c version :D

Re: GPS integration

Posted: Sat May 05, 2012 4:27 pm
by LuFa
10 flight later :)

I have big proplem with overshoot .
But i know its a proplem of the default setting from the Mediatek GPS , because its only 1hz at 9600bd .
Now i have search for a config tool and have found one :) The name is " Mini GPS Tool" (here is the Download link : http://www.robotshop.com/content/SOFTWA ... s-pa6b.zip) .
Know i have setup 10hz and 115200bd and hope i get a better GPS Position Hold .

now i waiting for the rain does stop outside :D

I will report after the next flight ;)

Re: GPS integration

Posted: Sat May 05, 2012 6:24 pm
by LuFa
now i have make some test flights with 10hz and 115200bd .

But the Position Hold is not realy better than bevor :(
First 10sek. the Copter Hover at the Hold Position , after some sek. the copter move to one site and the copter goes faster and faster and come not realy back to the Hold position .
Looks like the Compass is wrong , but in GUI the direction is right and also calibrated .

any ideas why ?

EDIT :

what make this line ?

Code: Select all

    SerialWrite(GPS_SERIAL,'$');
    SerialWrite(GPS_SERIAL,'P');
    SerialWrite(GPS_SERIAL,'M');
    SerialWrite(GPS_SERIAL,'T');
    SerialWrite(GPS_SERIAL,'K');
    SerialWrite(GPS_SERIAL,'2');
    SerialWrite(GPS_SERIAL,'2');
    SerialWrite(GPS_SERIAL,'0');
    SerialWrite(GPS_SERIAL,',');
    SerialWrite(GPS_SERIAL,'1');
    SerialWrite(GPS_SERIAL,'0');
    SerialWrite(GPS_SERIAL,'0');
    SerialWrite(GPS_SERIAL,'*');
    SerialWrite(GPS_SERIAL,'2');
    SerialWrite(GPS_SERIAL,'F');
    SerialWrite(GPS_SERIAL,'\r');
    SerialWrite(GPS_SERIAL,'\n');

Re: GPS integration

Posted: Sat May 05, 2012 6:49 pm
by EOSBandi
LuFa wrote:now i have make some test flights with 10hz and 115200bd .

But the Position Hold is not realy better than bevor :(
First 10sek. the Copter Hover at the Hold Position , after some sek. the copter move to one site and the copter goes faster and faster and come not realy back to the Hold position .
Looks like the Compass is wrong , but in GUI the direction is right and also calibrated .

any ideas why ?


1. did you check and set your magnetic declination ?
2. try changing pid values for powerful copter, decrease P for weak ones, increase....
3. with bad pid's it must oscillate and/or doing circles, if it's flying away then someting basically wrong....

Re: GPS integration

Posted: Sat May 05, 2012 6:53 pm
by LuFa
1. declanation is set to 2.55f
2. does i try tomorrow :)
3. yes i think so , but the Compass work , maybe a proplem of X Config ? I can not realy say if the Copter try to fly back , because i stop the copter after 30-40m .

Re: GPS integration

Posted: Sat May 05, 2012 7:26 pm
by EOSBandi
LuFa wrote:1. declanation is set to 2.55f
2. does i try tomorrow :)
3. yes i think so , but the Compass work , maybe a proplem of X Config ? I can not realy say if the Copter try to fly back , because i stop the copter after 30-40m .


just a short question, did you donwnloaded the whole dev code?

Re: GPS integration

Posted: Sat May 05, 2012 7:31 pm
by LuFa
yes ;)

but i have use copy paste for download your code :) because i have no SVN Client to download it , and i dont know how it work ^^

Re: GPS integration

Posted: Sat May 05, 2012 7:58 pm
by howardhb
@Lufa,
SerialWrite(GPS_SERIAL,'$');
SerialWrite(GPS_SERIAL,'P');
SerialWrite(GPS_SERIAL,'M');
SerialWrite(GPS_SERIAL,'T');
SerialWrite(GPS_SERIAL,'K');
SerialWrite(GPS_SERIAL,'2');
SerialWrite(GPS_SERIAL,'2');
SerialWrite(GPS_SERIAL,'0');
SerialWrite(GPS_SERIAL,',');
SerialWrite(GPS_SERIAL,'1');
SerialWrite(GPS_SERIAL,'0');
SerialWrite(GPS_SERIAL,'0');
SerialWrite(GPS_SERIAL,'*');
SerialWrite(GPS_SERIAL,'2');
SerialWrite(GPS_SERIAL,'F');
SerialWrite(GPS_SERIAL,'\r');
SerialWrite(GPS_SERIAL,'\n');

This forces the (MediaTek)GPS to output at 10Hz.

Re: GPS integration

Posted: Sat May 05, 2012 8:25 pm
by LuFa
ok , thanks !

is it need to that that every newstart from the Mwii or does the Mediatek safe this setup ?

Re: GPS integration

Posted: Sat May 05, 2012 10:31 pm
by howardhb
I've got a DiyDrones MTK2239
When I use MiniGPS_1.4.exe (with FTDI cable direct to the GPS) to change baud rate from 38400 to 115200 and update speed to 10Hz, it works fine, until power is removed.
All settings then revert to default 38400 baud and 1Hz update.

The work-around is to re-configure the GPS at every MultiWii startup.
In config, make a new #define for your defualt GPS baud rate. #define GPS_DEFAULT_BAUD 38400) (DiyDrones GPS is 38400)
and then also define the new GPS baudrate : #define GPS_BAUD 115200
At the end of gps.pde, make a serial function for the GPS,

Code: Select all

void GPS_Send_Char(const char *c) {
  while (*c) SerialWrite(GPS_SERIAL, *c++);
}


Then, in multiwii.pde, a the end of setup(), add the following code, to re-configure the GPS.......

Code: Select all

#if defined(GPS)  // This code sets the MediaTek GPS default 38400 baud to 115200 and set to send NEMA frames
    SerialOpen(GPS_SERIAL,GPS_DEFAULT_BAUD);   
    delay(10);
    GPS_Send_Char("$PMTK251,115200*1F\r\n");      //set baudrate 115200
    delay(10);
    SerialOpen(GPS_SERIAL,GPS_BAUD);   // open the serial port at the new speed
    delay(10);
    GPS_Send_Char("$PMTK314,1,1,1,1,1,5,1,1,1,1,1,1,0,1,1,1,1*2C\r\n");  //set to NMEA output
    delay(10);
    GPS_Send_Char("$PMTK220,100*2F\r\n");         //Will set the GPS to output serial at 10hz
    delay(10);
  #endif

Sometimes my GPS takes over 3 minutes to get a fix, other times, 35 seconds??? :o

Re: GPS integration

Posted: Sat May 05, 2012 10:39 pm
by LuFa
AAAAAAAAaaaaaaHHHHHhhhhhh :D
that is my proplem of the bad GPS Postition Hold 8-) i have set the new setup with Mini-GPS Tool but the GPS doesnt remember the setup after a new start .

Re: GPS integration

Posted: Sat May 05, 2012 10:40 pm
by howardhb
I'm using dev20120504 and my MAG never showed the correct direction, according to true compass readings, so I added declination and a compass installation angle correction.
Now, the heading indicator in the GUI, shows exactly NORTH (UP) when copter is facing North (used a hiking compass)
I think this is absolutely necessary for the GPS to work properly.

I made 2 defines in config.h:
#define MAG_DECLINATION -272 // NEGATIVE 27.2 degrres in Port Elizabeth
#define MAG_MOUNTING_ANGLE 1800 // My compass is mounted backwards?

In imu.pde: look for heading = _atan2( EstG.V.X * EstM.V.Z - EstG.V.Z * EstM.V.X , EstG.V.Z * EstM.V.Y - EstG.V.Y * EstM.V.Z ) /10;

Code: Select all

  #if MAG
    // Attitude of the cross product vector GxM
    heading = _atan2( EstG.V.X * EstM.V.Z - EstG.V.Z * EstM.V.X , EstG.V.Z * EstM.V.Y - EstG.V.Y * EstM.V.Z  );
    #if defined(MAG_DECLINATION) // defined in Config.h NOTE: negative or positive.  see: http://magnetic-declination.com
        heading += MAG_DECLINATION;   
    #endif
    #if defined(MAG_MOUNTING_ANGLE) // to correct the direction of heading indicator. MAG_MOUNTING_ANGLE defined in Config.h
        heading += MAG_MOUNTING_ANGLE;
    #endif
    heading /= 10;  // dividing by 10 here gives one decimal place precision for declination, without using floating point addition

    if ( heading > 180)   // Once we've added the declination and mounting angle correction, make sure heading is in the range of:   -180 < HEADING > 180
       heading -= 360;
    else if (heading < -180)
    heading += 360;

  #endif

Re: GPS integration

Posted: Sat May 05, 2012 10:46 pm
by LuFa
@howardhb : have your GPS a backup battery ?

Re: GPS integration

Posted: Sat May 05, 2012 10:59 pm
by howardhb
You can find your specific declination here: http://magnetic-declination.com/

Re: GPS integration

Posted: Sat May 05, 2012 11:17 pm
by howardhb
LuFa wrote:@howardhb : have your GPS a backup battery ?


No it doesn't :cry: I've spent hours (many many minutes added up) waiting for GPS fix.....
I might just add a 3V lithium cell or a super capacitor for back-up, for when changing the copter's lipo for a new flight...
MediaTek Battery Backup.png

Re: GPS integration

Posted: Sun May 06, 2012 5:22 am
by Quad FRITZ
@EOSBandi

Thank you so much for the quick reply!
I ll stay tuned because it is bejond my horizon to implement it myself ;-) (or at leat I do not have the time :lol: )

Kind regards
Roman

Re: GPS integration

Posted: Sun May 06, 2012 4:43 pm
by LuFa
does onywhere no , why Serial Sum doesnt work at Arduino Mega and Mwii 2.0 with EOSBandi GPS ?
The Channles move right in the GUI but with big spiks :(
PPM is connect to PIN 19 (Serial1)

Re: GPS integration

Posted: Sun May 06, 2012 5:05 pm
by howardhb
@Lufa, just add : Look in config.h
For PPM input on the mega, you must:

Code: Select all

/**********************************    Buzzer Pin    **********************************/
// this moves the Buzzer pin from TXO to D8 for use with ppm sum or spectrum sat. RX (not needed if A32U4ALLPINS is active)
 #define D8BUZZER

Re: GPS integration

Posted: Sun May 06, 2012 6:19 pm
by LuFa
@howardhb : same proplem :( i use graupner MX16 Hott with GR-16

Edit : Have found the proplem ;) the Receiver is defect .

Question to EOSBandi : it the Home and Hold position allready store in :

GPS_latitude_hold
GPS_longitude_hold

and

GPS_latitude_home
GPS_longitude_home

?

thanks ;)

Re: GPS integration

Posted: Sun May 06, 2012 7:08 pm
by EOSBandi
LuFa wrote:@howardhb : same proplem :( i use graupner MX16 Hott with GR-16

Edit : Habe found the proplem ;) the Receiver is defect .

Question to EOSBandi : it the Home and Hold position allready store in :

GPS_latitude_hold
GPS_longitude_hold

and

GPS_latitude_home
GPS_longitude_home

?

thanks ;)

Yes

Re: GPS integration

Posted: Sun May 06, 2012 7:54 pm
by LuFa
great :D is GPS_distanceToHold and GPS_distanceToHome also in use ?

Re: GPS integration

Posted: Mon May 07, 2012 9:02 am
by EOSBandi
I pushed a quick update to the code,

Simplify GPS nav correction rotation into copters's frame reference
Increased mag declination calculation precisity based on HowardHB idea http://ww
w.multiwii.com/forum/viewtopic.php?f=8&t=649&sid=b2fce6b235836b8406d1b312d3ae0a1
2&start=530#p13470
Lowered default nav pid-s (still need to be tuned...)

Now moving to i2c_gps.....