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
LuFa
Posts: 160
Joined: Fri Jan 27, 2012 7:56 pm

Re: GPS integration

Post by LuFa »

does anywhere now if i should make a update to v1.6 of the MTK3329 ?

http://code.google.com/p/ardupilot/wiki/MediaTek

marbalon
Posts: 107
Joined: Thu Aug 18, 2011 10:59 am

Re: GPS integration

Post by marbalon »

No you can't, you will broke your gps. But you don't need this just set 10hz via pmtk command.
Regards.

User avatar
Jonit
Posts: 37
Joined: Sat May 12, 2012 10:12 pm
Location: Slovakia

Re: GPS integration

Post by Jonit »

Tommie wrote:Yes, I used my TinyGPS chip with a bluetooth GPS once. Most BT GPS devices are just plain old serial GPS receivers with an additional BT module slapped on. If you can identify the TTL-TX wire inside the device, you can just use it like any serial GPS.

Thanks! but I rather thought, that if it can be done via Bluetooth. If it is possible to comunicate through MWC BT module, so i don't need to disassemble and solder things.
Jonit

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

Re: GPS integration

Post by dramida »

Flying MWC R10 EoBandi branch in windy condition:

Good things:
RTH is working but sometimes it dosen't come straight to home but in zig-zag
Pos hold is working in a radius smaller (5m) or bigger, depending on ...i don't know what

Other things:
- When reaching home, a few times overshoot greatly and i had to take manual control;
- Can't calibrate giros from the sticks. (or at least i have no visual confirmation about that)

http://www.youtube.com/watch?v=CYC4-I9bZcg

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

Re: GPS integration

Post by dramida »

2 cents ideea (taken from a topographer):

The GPS reading has X-Y positioning errors. It woud be useful to use a averaging moving vector with last 3-5 readings. (As in giro smoothing)

wilco1967
Posts: 156
Joined: Thu Aug 18, 2011 6:04 pm
Location: Winterswijk, Netherlands

Re: GPS integration

Post by wilco1967 »

Tried today the R10 EOSBandi code with a 1Hz GPS, even though it was mentioned it would not work on 1Hz...... :roll:
Old wooden Tricopter, with Flyduino mega, WM+, BMA-020, HS5883, BMP-085, 900 kV 10x4.5 props

Well..... it DID work....
Ok, far from perfect, but still better than the original code...
all with the default settings (except GPS at only 4800 baud)

It will hold reasonably well in a moderate wind (approx 3 Bft), within lets say 20 meters. I could fly one complete battery (10 min) in loiter mode, without having it going astray, or starting to circle in even larger circles like the original code does.

When RTH is activated, it will come home, although not in a straight line. It might initially wander off like 30deg, but than correct its course as it approaches, and come back. It might overshoot 10 mtrs or so, but will find its way back ultimately. I guess the compass is not entirely correct (although it no longer suffers from the power wiring).

What I did observe was it might not always come home exactly to the right spot, but perhaps 10..20 meters from it downwind.I guess the wind is to blame for that.

Anyway, not perfect, but still good enough to bring it back to me if I loose orrientation.... and it is way cool to leave it hanging there without touching the controls.

Thanks you very much for the hard work, EOSBandi

Now lets see if I can get 'approval' from the wife for a 10 Hz GPS ;)

Wilco

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

Re: GPS integration

Post by EOSBandi »

OK folks,
Since I had a serious weather all weekend and it's still raining, I cannot flight test it. But I share for for testing.
(As usual, use it for your own risk...)

You can find the code here : http://code.google.com/p/i2c-gps-nav/downloads/list. You can download the MultiWiiDev-Nav version.

What to do to compile :
There are two libs in the "arduino-pid-libs" folder. Copy those to your arduino libraries folder.
Update the twi libs in the libraries/Wire/Utility folder

I2C_GPS_NAV.ino is the code for the i2c gps module. It's a simple arduino, with a gps attached to the serial tx/rx and the i2c port wired to the flight controller's 5volt i2c port. You also van use Flytron's navigatron or other i2c_gps modules. Set your gps to 115200 baud and 10Hz if possible. (change init code in setup() if necessary)

The MultiWii and the MultiWiiConf folder contains a copy of the recent MultiWii code and a modded MultiWiiConf. You can set the navigation PID's from the GUI now. If you willing to use serial gps you can do that too, the navigational routines for serial gps are also included in the MultiWii code.

Setup :
in config.h choose which gps are you willing to use.
set your magnetic decliniation

PLEASE do not fight with an old 1Hz/4800 bps GPS module, you will never get satisfactory results. You need at least a 5Hz update rate for precise navigation and pos hold. The default pid's are for 10Hz.

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

Re: GPS integration

Post by Katch »

I'll give this a go tomorrow if the wind drops a bit.

marbalon
Posts: 107
Joined: Thu Aug 18, 2011 10:59 am

Re: GPS integration

Post by marbalon »

Thanks for your work, I've just upload all codes to my i2c module and MWC board with required changes, compile gui and it works! I get some i2c errors but remove delay(1000) from i2c module setup procedure and now works fine - no i2c errors at start. tomorrow I will try to make tests.

Again thank you.

User avatar
howardhb
Posts: 189
Joined: Tue Oct 11, 2011 7:10 pm
Location: Port Elizabeth, South Africa

Re: GPS integration

Post by howardhb »

Thanks @EOSBandi!

I will test this in the morning.....

Please confirm, In IMU.pde:

Code: Select all

    // Attitude of the cross product vector GxM
//******************************************EOSBANDI - removed /10 to increase precision of decliniation calc   
    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  );
//******************************************EOSBANDI 
    //add declination
    //Heading is -180 - 180 had to wrap up accordingly
    heading = heading + MAG_DECLINIATION

   heading = heading /10;               // /10 moved here from above


It seems that only a 10th of the defined magnetic declination is being added to heading, owing to the division by 10, after adding declination?
Is this as you require it?

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

Re: GPS integration

Post by EOSBandi »

howardhb wrote:Thanks @EOSBandi!

I will test this in the morning.....

Please confirm, In IMU.pde:

Code: Select all

    // Attitude of the cross product vector GxM
//******************************************EOSBANDI - removed /10 to increase precision of decliniation calc   
    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  );
//******************************************EOSBANDI 
    //add declination
    //Heading is -180 - 180 had to wrap up accordingly
    heading = heading + MAG_DECLINIATION

   heading = heading /10;               // /10 moved here from above


It seems that only a 10th of the defined magnetic declination is being added to heading, owing to the division by 10, after adding declination?
Is this as you require it?


you are right, nice catch. It sould be
heading = headig + MAG_DECLINIATION * 10;

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

Re: GPS integration

Post by Katch »

MelihK wrote:Improved version of EOS Bandit's I2C GPS Code,

Features:
  • 9600 baud standard GPS switching code added, this MTK command switching the GPS module to 115200 baud. You can use same command set with any baudrate to 115200
  • NMEA sentence configurator MTK command added. It is removing useless NMEA codes from the stream.
  • LED indicator added. Arduino LED(pin 13) blinking for 3 seconds at start and very short blinks after GPS lock.

@EOS Bandit, Please check it and add into your repository, if they are useful features.

I2C_GPS_NAV.zip


EOS Bandit are these changes implemented in your new code - should it work with Melih's Navigtron without changes?

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

Re: GPS integration

Post by EOSBandi »

GPS speed : yes
NMEA sentences config : no, will put there soon, but it's not really an issue
LED indicator: improved thanks to Guru_Florida
* 3 short flash at startup
* blinks once per second if gps is sending data but no position lock yet
* blinks twice fast, then off for a second if gps 2D position is available
* blinks 3 times fast, then off for a second if gps 3D position is available
* or goes on for a second, off for a second, (long pulse) if not getting any NEMA sentences for over 5 seconds

User avatar
howardhb
Posts: 189
Joined: Tue Oct 11, 2011 7:10 pm
Location: Port Elizabeth, South Africa

Re: GPS integration

Post by howardhb »

Arrrrggghh - Wind and Rain preventing testing... :shock: :shock:

In the mean time, if anyone is interested, I've updated LCD.pde so that GPS parameters can be displayed and edited via VT100 Terminal /LCD / OLED.
Just replace LCD.pde with this one. (in the attached zip)

H.
Attachments
LCD.zip
(16.63 KiB) Downloaded 239 times

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

Re: GPS integration

Post by EOSBandi »

Great, will put it to the repo afternoon

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

Re: GPS integration

Post by Katch »

sorry if this is a silly question but why is there an f at the end of the magnetic declination?

can someone check mine

2 degree 57 minutes west = -2.59f ?

User avatar
howardhb
Posts: 189
Joined: Tue Oct 11, 2011 7:10 pm
Location: Port Elizabeth, South Africa

Re: GPS integration

Post by howardhb »

2 degree 57 minutes west = -2.59f ?

@Katch, the "f" simply means that the #define is a Floating point number.
Yes, -2.59f is correct for declination of: 2 degrees, 57 minutes, West

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

Re: GPS integration

Post by Katch »

Ok - next problem

Getting no satellites in the GUI. Navigtron board with the latest i2c code

GPS is green in the GUI
3 i2c errors
at start up the red and blue light on the navigtron flash one sec opposite each other - after a while the red light stops flashing - blue light continues every 1 second.

edit

I've tried this;

Code: Select all

  //Assume 9600 bps
 Serial.begin(9600);
 Serial.print("$PMTK251,115200*1F\r\n");
 delay(1000);
 Serial.end();
 
 Serial.begin(115200);
 Serial.println("$PMTK314,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29");
  delay(1000);//Enable it for 10Hz mode
  Serial.println("$PMTK300,100,0,0,0,0*2C"); //Enable it for 10Hz mode


but get the same results.

I've also tried putting a test sketch on the arduino before flashing to make sure the GPS is back on 9600.

Edit 2

I'm getting serial data off the FTDI interface at 9600 ...

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

Re: GPS integration

Post by Katch »

winner winner chicken dinner :)

This version works with Flytron Navigtron and also removes useless nmea sentences.

Code: Select all

  //Assume 9600 bps
  Serial.begin(9600);
  Serial.print("$PMTK251,115200*1F\r\n");
  Serial.end();
  delay(1000);
  Serial.begin(115200);
  Serial.print("$PMTK220,100*2F\r\n");
   delay(1000);
   Serial.println("$PMTK314,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29");
  delay(800);//Enable it for 10Hz mode
  Serial.println("$PMTK300,100,0,0,0,0*2C"); //Enable it for 10Hz mode
 


also attached as zip ready to go.

You may need to flash this first;

Code: Select all


/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.
 
  This example code is in the public domain.
 */
 
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;

// the setup routine runs once when you press reset:
void setup() {               
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);     
}

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second
}


to make sure the GPS is back on 9600 to receive the mtk commands in setup.
Attachments
I2C_GPS_NAV_mod.zip
(11.76 KiB) Downloaded 294 times

User avatar
howardhb
Posts: 189
Joined: Tue Oct 11, 2011 7:10 pm
Location: Port Elizabeth, South Africa

Re: GPS integration

Post by howardhb »

@Katch, your GPS (MTK3329?) cannot understand this:

Code: Select all

Serial.println("$PMTK300,100,0,0,0,0*2C"); //Enable it for 10Hz mode


To set 10Hz, try this:

Code: Select all

Serial.println("$PMTK220,100*2F\r\n");

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

Re: GPS integration

Post by Katch »

That was a line of code suggested by Melih and I couldn't get the GPS working without it.

Yes it's MTK3329

here's a datasheet for the MTK commands http://www.flytron.com/pdf/MTK_commands.pdf

User avatar
howardhb
Posts: 189
Joined: Tue Oct 11, 2011 7:10 pm
Location: Port Elizabeth, South Africa

Re: GPS integration

Post by howardhb »

I see... Those instructions are different to the DiyDrones MTK3329.

I'm glad you've got yours working! :mrgreen:

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

Re: GPS integration

Post by Katch »

just wish it wasn't 30mph wind here today.... nevermind

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

Re: GPS integration

Post by dramida »

I found one cause of inconsistent GPS HOLD behaviour. It seems that the GPS readings are not-so consistent. Look to this short clip at gps values as the copter is sitting on the ground.
http://www.youtube.com/watch?v=KTyao-gr_jM
It would be nice to filter out those extremes as we do with giro with a moving average vector.

LenzGr
Posts: 166
Joined: Wed Nov 23, 2011 10:50 am
Location: Hamburg, Germany
Contact:

Re: GPS integration

Post by LenzGr »

howardhb wrote:I see... Those instructions are different to the DiyDrones MTK3329.

Speaking of which, I too have the MediaTek MT3329 GPS from DIYdrones, which seems to use a custom binary protocol. Is this one supported by the current code? AFAIK it can be configured to use the classic NMEA protocol at 10Hz, but this requires sending commands to the device. Would it make sense to add support for parsing the DIYdrones protocol as well?

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

Re: GPS integration

Post by EOSBandi »

LenzGr wrote:
howardhb wrote:I see... Those instructions are different to the DiyDrones MTK3329.

Speaking of which, I too have the MediaTek MT3329 GPS from DIYdrones, which seems to use a custom binary protocol. Is this one supported by the current code? AFAIK it can be configured to use the classic NMEA protocol at 10Hz, but this requires sending commands to the device. Would it make sense to add support for parsing the DIYdrones protocol as well?


DIYDrones gps is starting with NMEA/38400baud. It is switched to custom binary mode by the arducopter firmware. So you can use it with currect i2cgps code. only start at 38400 baud, and change the refresh rate and the baud rate....

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

Re: GPS integration

Post by Scotth72 »

LenzGr wrote:
howardhb wrote:I see... Those instructions are different to the DiyDrones MTK3329.

Speaking of which, I too have the MediaTek MT3329 GPS from DIYdrones, which seems to use a custom binary protocol. Is this one supported by the current code? AFAIK it can be configured to use the classic NMEA protocol at 10Hz, but this requires sending commands to the device. Would it make sense to add support for parsing the DIYdrones protocol as well?


See this thread:
viewtopic.php?f=6&t=1682

LenzGr
Posts: 166
Joined: Wed Nov 23, 2011 10:50 am
Location: Hamburg, Germany
Contact:

Re: GPS integration

Post by LenzGr »

EOSBandi wrote:DIYDrones gps is starting with NMEA/38400baud. It is switched to custom binary mode by the arducopter firmware. So you can use it with currect i2cgps code. only start at 38400 baud, and change the refresh rate and the baud rate....

Ah, good to know! Thanks for this info, will give it a try. I somehow assumed it defaults to the custom binary protocol...
That spares me from having to update the firmware, I guess :)

User avatar
howardhb
Posts: 189
Joined: Tue Oct 11, 2011 7:10 pm
Location: Port Elizabeth, South Africa

Re: GPS integration

Post by howardhb »

I must say that my GPS is working far better after flashing the firmware with:
FMP04_Camled_010327_A1.5E_20110118_10Hz_115200.bin
( see previous post from from @Scotth72 )
Just follow the instructions 100%.
You have to load Flashing firmware for the Flashtool program, AND GPS firmware.....

After flashing, I used the latest version of Mini GPS Tool V1.7.1 ( http://www.gtop-tech.com/jsf/download.jsf )
Set COM port to 38400, then press Connect. NB: Then press Ctrl + Alt + S to show the setup menu.
I was then able to set the GPS to output ONLY GGA, GSA and GSV sentences at 115200baud and 10Hz, and SAVE these settings.

So, after doing this, the MTK3329 (DiyDrones) and code from EOSBandi (both serial and I2C) can be used with confidence, at 115kb and 10Hz.

I had a chance, this morning, to test the new GPS Position Hold.
Position Hold definitely works very well. Hovered for 8 minutes in an area of about 1m radius, hands off!
Conditions were calm, almost no wind, but some small gusts, enough to see copter correcting!
Need to play some more with RTH PID's - overshoots a bit +- 10m, getting progressively worse.
I think lowering NavR P and PosR P will be the place to start.

H.

LenzGr
Posts: 166
Joined: Wed Nov 23, 2011 10:50 am
Location: Hamburg, Germany
Contact:

Re: GPS integration

Post by LenzGr »

Awesome. I'll give this a try, thanks a lot!

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

Re: GPS integration

Post by jevermeister »

howardhb wrote:I must say that my GPS is working far better after flashing the firmware with:
FMP04_Camled_010327_A1.5E_20110118_10Hz_115200.bin
( see previous post from from @Scotth72 )
Just follow the instructions 100%.
You have to load Flashing firmware for the Flashtool program, AND GPS firmware.....

After flashing, I used the latest version of Mini GPS Tool V1.7.1 ( http://www.gtop-tech.com/jsf/download.jsf )
Set COM port to 38400, then press Connect. NB: Then press Ctrl + Alt + S to show the setup menu.
I was then able to set the GPS to output ONLY GGA, GSA and GSV sentences at 115200baud and 10Hz, and SAVE these settings.

So, after doing this, the MTK3329 (DiyDrones) and code from EOSBandi (both serial and I2C) can be used with confidence, at 115kb and 10Hz.

I had a chance, this morning, to test the new GPS Position Hold.
Position Hold definitely works very well. Hovered for 8 minutes in an area of about 1m radius, hands off!
Conditions were calm, almost no wind, but some small gusts, enough to see copter correcting!
Need to play some more with RTH PID's - overshoots a bit +- 10m, getting progressively worse.
I think lowering NavR P and PosR P will be the place to start.

H.

hey,

Is this neccesary to run the GPS with the nu code what is thhe difference?what is neded to flash the fmp?

thank ya
nils

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

Re: GPS integration

Post by EOSBandi »

Guys, I found a serious issue with the PID settings, pushed an update please use it.
(I turned out that teh PIDITEMS define is not used in the definitions of the PID arrays :( )

The updated gps firmware adds defuault 10Hz and 115200bps settings, plus allows you to save your desired settings into the flash on the gps module. Which removes the burden of setting the gps module on the fly (which is a kind a tricky and unpredictable especially with navigatron :( )

LuFa
Posts: 160
Joined: Fri Jan 27, 2012 7:56 pm

Re: GPS integration

Post by LuFa »

only at the i2c gps code ?? or also at Serial GPS Code ?

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

Re: GPS integration

Post by EOSBandi »

howardhb wrote:
I had a chance, this morning, to test the new GPS Position Hold.
Position Hold definitely works very well. Hovered for 8 minutes in an area of about 1m radius, hands off!
Conditions were calm, almost no wind, but some small gusts, enough to see copter correcting!
Need to play some more with RTH PID's - overshoots a bit +- 10m, getting progressively worse.
I think lowering NavR P and PosR P will be the place to start.

H.


Hi. try to increase the D terms... i flew with these last time... and got a quite OK RTH...

#define POSHOLD_P .11
#define POSHOLD_I 0.0
#define POSHOLD_RATE_P 1.4
#define POSHOLD_RATE_I 0.2
#define POSHOLD_RATE_D 0.018
#define NAV_P 1.4
#define NAV_I 0.22
#define NAV_D 0.008

You also can lower the navigational speed max (at the moment it's not wired out to gui, so you have to change it in the i2c_gps_nav config.h NAV_SPEED_MAX to 300...)

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

Re: GPS integration

Post by EOSBandi »

LuFa wrote:only at the i2c gps code ?? or also at Serial GPS Code ?

Multiwii base code.. :(

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

Re: GPS integration

Post by jevermeister »

Argh I so want to test your code mate, but I broke my hand and can not use my tx :-(

Are u in contact with alex, will it be in the trunk?

nils

LuFa
Posts: 160
Joined: Fri Jan 27, 2012 7:56 pm

Re: GPS integration

Post by LuFa »

EOSBandi wrote:
LuFa wrote:only at the i2c gps code ?? or also at Serial GPS Code ?

Multiwii base code.. :(


ok

because i have only see a update from the i2c code :?

User avatar
howardhb
Posts: 189
Joined: Tue Oct 11, 2011 7:10 pm
Location: Port Elizabeth, South Africa

Re: GPS integration

Post by howardhb »

#define POSHOLD_P .11
#define POSHOLD_I 0.0
#define POSHOLD_RATE_P 1.4
#define POSHOLD_RATE_I 0.2
#define POSHOLD_RATE_D 0.018
#define NAV_P 1.4
#define NAV_I 0.22
#define NAV_D 0.008

Thanks! Will fly again this afternoon. (un-characteristically perfect, windless conditions here! :mrgreen: )

If you wouldn't mind, please push my updated LCD / OLED ... (attached zip)
Attachments
LCD.zip
Added GPS PID's to LCD_CONF
(16.63 KiB) Downloaded 234 times

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

Re: GPS integration

Post by EOSBandi »

LuFa wrote:
EOSBandi wrote:
LuFa wrote:only at the i2c gps code ?? or also at Serial GPS Code ?

Multiwii base code.. :(


ok

because i have only see a update from the i2c code :?

http://code.google.com/p/i2c-gps-nav/source/detail?r=22
Log message
A serious issue with PID settings identified and corrected.
(PID array definition did not used PIDITEMS define... )
Without this fix r20 and r21 is unflyable!!!!!

Modify /trunk/I2C_GPS_NAV/I2C_GPS_NAV-MultiwiiDev-NAV/MultiWii/MultiWii.ino
Modify /trunk/I2C_GPS_NAV/I2C_GPS_NAV-MultiwiiDev-NAV/MultiWii/Serial.ino
Modify /trunk/I2C_GPS_NAV/I2C_GPS_NAV-MultiwiiDev-NAV/MultiWiiConf/MultiWiiConf.pde

LuFa
Posts: 160
Joined: Fri Jan 27, 2012 7:56 pm

Re: GPS integration

Post by LuFa »

ah ok , you have also the Serial GPS code move to the i2c gps project page :)
because the latest version wich i have use is r10 . Have r10 the same proplem ?

if i understand it right , r22 is for i2c and Serial GPS ?

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

Re: GPS integration

Post by Katch »

r22 error while compiling... line 435 multiwii.ino

debug3=get_free_memory();

compiler message

MultiWii.cpp: In function 'void annexCode()':
MultiWii:434: error: 'get_free_memory' was not declared in this scope


Edit - ok something seriously wrong with r22

using FreeIMU 0.4.3

removed the debug line above and it will compile and upload

Once done the copter no longer has any pitch or roll control - the channels change in the GUI but do not change the motor speed.

Something very broken - do not try to fly this r22 without verifying you definitely have pitch and roll control - I don't

back to 21 and everything works again.

EDIT 2 - seems to be strangely linked to level mode being active. need to do more tests.


IMPORTANT EDIT

Seems to be linked to the way my i2c gps is attached to my Paris v4 - I have moved to my MWC with FreeIMU 0.3.5ms and its behaving again.

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

Re: GPS integration

Post by dr.tom »

Katch wrote:Once done the copter no longer has any pitch or roll control - the channels change in the GUI but do not change the motor speed.

Something very broken - do not try to fly this r22 without verifying you definitely have pitch and roll control - I don't


how is your rate setting set?
is it left @ 0 ?

in gui, it seems to work OK,
stick input(pitch/roll) is shown in motor action when armed. in gyro and level mode, both.
Attachments
rate.JPG
(13.1 KiB) Not downloaded yet

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

Re: GPS integration

Post by Katch »

Ok - just flown 2 pack on my MWC 0.3.5ms with I2C GPS

Still a little windy so not getting great results - but getting results nonetheless.

10mph winds

Return to home very definitely brought it back a couple of times and stopped nicely overhead.

Pos Hold - seems to either wander off or circle larger and larger circles until I have to take control.

Still not sure why my Paris v4 board was playing up but I do have my IMU on the LV side of the LLC and the GPS on the HV side. Something is messing with the i2c data along the line somewhere as it is only when the GPS board is attached that I have this lack of control.

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

Re: GPS integration

Post by EOSBandi »

Katch wrote:Ok - just flown 2 pack on my MWC 0.3.5ms with I2C GPS

Still a little windy so not getting great results - but getting results nonetheless.

10mph winds

Return to home very definitely brought it back a couple of times and stopped nicely overhead.

Pos Hold - seems to either wander off or circle larger and larger circles until I have to take control.


So it's time to start with the settings. Try increase POSHOLD_RATE_D, or decrease POSHOLD_P and POSHOLD_RATE_P. If in RTH it comes back and stops then it means your settings are not far from OK.

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

Re: GPS integration

Post by Katch »

waiting for my packs to charge - will go out after dinner and hopefully less wind.

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

Re: GPS integration

Post by EOSBandi »

I pushed meanwhile r24. No changes exept I removed the erronous line and added Howard's lcd.ino modifications. (Thanks Howard !) and compiled the MultiWiiConf for Mac too.

User avatar
Gaijin
Posts: 82
Joined: Sat Jan 14, 2012 8:00 am

Re: GPS integration

Post by Gaijin »

EosBandi,

2 items of feedback:

1) With this release my pitch and roll inputs to the FC no longer have any effect even though the board will arm and hover just fine , the TX inputs appear correct in the GUI, input provided by CPPM on a futaba mapping, worked okay on your release from earlier this week.

2) The GUI will not connect to Com 15 via bluetooth serial, it just doesn't list it, again the last iteration was fine is this regard, the side effect is I can't cal the mag with the motors spinning and I can't check the GPS info whilst it is powered by battery.

I2C errors whilst powered by USB however are down to 0 from 6 on Quadrino Zoom /Flytron Navigatron setup

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

Re: GPS integration

Post by Katch »

That is the same set of observations I found with my Paris v4 and GY_86 IMU

The problems did not persist when I switched to my MWC board - FreeIMU 0.3.5ms all running of 5v and HV i2c lines

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

Re: GPS integration

Post by Katch »

Increased PosR from 1.4 to 1.7

hold seems to be a smaller circle now.

There still seems to be some level of randomness in whether RTH or POS Hold work well or not. I can fly to a similar location 4 or 5 times and engage POS Hold and get different results ranging from a good hold to heading off in some random direction.

I've also notice a pronounced kick of the motors when POS Hold is engaged which tends to throw the quad off its hold point and starts the pendulum effect circles.

RTH always brings it back and always slows as it approaches - after that its the same as POS Hold - sometimes good sometimes bad.

I also noticed that altitude hold is not great in either case - the quad often gains or looses altitude beyond what is acceptable. I've had it climb 30 or more meters and in another instance loose altitude from 20m to the ground.
Last edited by Katch on Wed May 16, 2012 7:17 pm, edited 1 time in total.

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

Re: GPS integration

Post by dr.tom »

happy for you that can try it 8-)
I get tons of I2C errors, gps is green in GUI, but no gps data is shown, all zeros. :(

Crius SE + Navigatron
all flashed ok, with Katch's blink code first, it blinks ON/OFF
then with latest EosBandi's code+Katch's patch for navigatron@10Hz,
Navigatron blinks 3times per sec after 10sec from powerup = 3D fix, so that works ok i guess.
(without patch it blinks 1sec ON/OFF long= 'no nmea', because of low baud rate i guess)


is there some conflict with BMA180? 0x40 address is same for gps and bma,
i'm no expert, just found that by search function when looking what addresses are used for what... maybe I'm wrong

stock navigatron firmware works ok on previous MWC releases (dev20120504), flight tested with gps RTH OK,
so hardware part + connections are ok.

Image

thanks for help :)
Last edited by dr.tom on Wed May 16, 2012 8:28 pm, edited 2 times in total.

Post Reply