Posted by Jordi Muñoz on September 30, 2009 at 4:59pm
Hi there, well I'm happy to announce the new ArduPilot 2.4 firmware, i still have many things to add, but i will leave them for 2.5 .What's new:-Improved ADC conversion, now uses interrupts to free some CPU.-uBlox parser bug fix, now i can navigate better.-Added a new header option called "ALT_HOLD_HOME". Let you select what altitude you want to hold for home, 0 will hold the altitude you are when you switch to RTL, 1 = will hold the altitude defined on the confiq. tool.-Altitude hold dramatically improved for my Easystar. (Thanks to Bill!).-Airspeed and throttle control improved.To do:-Add Happy Kill More code for Remzibi Integration.-Change the TX protocol to binary.-Use interrupts for the serial output.-Header typos correction.-Maybe cross-track error or another solution to fly straight lines between waypoints.Source Code: ArduPilot_EasyStar_V24.zipMy header: easystar.h
remzibi
i'm sure that 5hz is not a good idea if you don't had a a little peace of code to take care of overflow problems...
but somebody here did a simple little protection function, you'll just have to search because i can't put my hand on it right now
regards
fefenin
Uart transmission is not buffered in Arduino - it's written in the manual and I test it (hope if the manual is out of date) but definoitely not buffered.
Till now - parser is OK - the only thing to fix I found was that initial configurations :) .
Also hardware UART transmition is buffered (I didn't look how it work exactly) , so 5Hz should work withoput any problem of overflow and even faster.
Delay is because some models of GPS need about 10-40ms to write propertly new settings to his eeprom .
In almost new modules this delay is not needed - so all this delay(500); can be removed (saving space in mega :) ).
Also datum is important , as some modules from factory has set different datum configuration as default .
So I could use my EA85 with ArduPilot and this code?? Great now I have 3 different GPS for use with ArduPIlot cool. I think delay with ArduPilot is due to wait for fix??
Ok - it is immportant to first select NMEA_OUTPUT_GGA_RMC - and then select LOCOSYS_REFRESH_RATE_5Hz - as if MTK chipset detect too much info in update interval will not "consume" this settings and return error .
Once more - unfortuante I can not edit :)
So finally here is my proposal for NMEA MTK ready to copy-paste :
#define NMEA_OUTPUT_GGA_RMC "$PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0*28" //Set GGA and RMC
#define MTK_REFRESH_RATE_5HZ "$PMTK220,200*2C" //200 milliseconds - 5Hz update
#define MTK_REFRESH_RATE_4HZ "$PMTK220,250*29" //250 milliseconds - 4Hz update
#define MTK_REFRESH_RATE_3HZ "$PMTK220,333*2D" // 3Hz update if some one wants
#define MTK_WAAS_SET1 "$PMTK313,1*2E" //WAAS setting
#define MTK_WAAS_SET2 "$PMTK301,2*2E" //WAAS setting
#define MTK_DATUM_GOOGLE "$PMTK330,220*2E" // datum 220 to be sure GPS works compatible with Google map
usage :
void init_gps(void)
{
pinMode(12, OUTPUT);//Status led
Serial.begin(9600); //remove for 38400 or type proper default speed
delay(1000);
Serial.println(MTK_BAUD_RATE_38400);
Serial.begin(38400); //remove for 9600 GT module
delay(500); // delays are not need for some modules and can be removed (for GT module can be removed)
Serial.println(NMEA_OUTPUT_GGA_RMC); // first reduce string quantity
delay(500);
Serial.println(MTK_REFRESH_RATE_5Hz); // second made fast update
delay(500);
Serial.println(MTK_WAAS_SET1); // to waas set
delay(500);
Serial.println(MTK_WAAS_SET2); // to waas set , we want know exactly where we are
delay(500);
Serial.println(MTK_DATUM_GOOGLE ); // to be sure that our indications are compatible with Google map offset
}
i already pointed out somwhere that the rate define was set up the oposite...
but i'm not sure about the 5hz cause Jordi pointed out a few times that the buffer could overflow if the GPS is set at more than 4hz...
I am not absolute sure - but I think - that the GPS startup was faster when the GPS was connected direct to the remzibi OSD. Maybe there is a command about the start mode the OSD sends to the module, and Ardupilot misses?
I have the stock GPS modul shipped with the remzibi OSD.
If I remember well, capturing 7 satellites takes no more then 2-3 minutes when the modul is connected direct to the OSD.
Now it is connected to Ardupilot, and it takes as much as 10-15 minutes. It's probably not interference, as for the end of the flight it has as much as 10 satellites.
But again, I am not sure, maybe just not remember well.
Comments
i'm sure that 5hz is not a good idea if you don't had a a little peace of code to take care of overflow problems...
but somebody here did a simple little protection function, you'll just have to search because i can't put my hand on it right now
regards
fefenin
Also hardware UART transmition is buffered (I didn't look how it work exactly) , so 5Hz should work withoput any problem of overflow and even faster.
In almost new modules this delay is not needed - so all this delay(500); can be removed (saving space in mega :) ).
Also datum is important , as some modules from factory has set different datum configuration as default .
Once more - unfortuante I can not edit :)
So finally here is my proposal for NMEA MTK ready to copy-paste :
#define NMEA_OUTPUT_GGA_RMC "$PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0*28" //Set GGA and RMC
#define MTK_REFRESH_RATE_5HZ "$PMTK220,200*2C" //200 milliseconds - 5Hz update
#define MTK_REFRESH_RATE_4HZ "$PMTK220,250*29" //250 milliseconds - 4Hz update
#define MTK_REFRESH_RATE_3HZ "$PMTK220,333*2D" // 3Hz update if some one wants
#define MTK_WAAS_SET1 "$PMTK313,1*2E" //WAAS setting
#define MTK_WAAS_SET2 "$PMTK301,2*2E" //WAAS setting
#define MTK_DATUM_GOOGLE "$PMTK330,220*2E" // datum 220 to be sure GPS works compatible with Google map
usage :
void init_gps(void)
{
pinMode(12, OUTPUT);//Status led
Serial.begin(9600); //remove for 38400 or type proper default speed
delay(1000);
Serial.println(MTK_BAUD_RATE_38400);
Serial.begin(38400); //remove for 9600 GT module
delay(500); // delays are not need for some modules and can be removed (for GT module can be removed)
Serial.println(NMEA_OUTPUT_GGA_RMC); // first reduce string quantity
delay(500);
Serial.println(MTK_REFRESH_RATE_5Hz); // second made fast update
delay(500);
Serial.println(MTK_WAAS_SET1); // to waas set
delay(500);
Serial.println(MTK_WAAS_SET2); // to waas set , we want know exactly where we are
delay(500);
Serial.println(MTK_DATUM_GOOGLE ); // to be sure that our indications are compatible with Google map offset
}
This for all MTK based GPS modules
i already pointed out somwhere that the rate define was set up the oposite...
but i'm not sure about the 5hz cause Jordi pointed out a few times that the buffer could overflow if the GPS is set at more than 4hz...
I have the stock GPS modul shipped with the remzibi OSD.
If I remember well, capturing 7 satellites takes no more then 2-3 minutes when the modul is connected direct to the OSD.
Now it is connected to Ardupilot, and it takes as much as 10-15 minutes. It's probably not interference, as for the end of the flight it has as much as 10 satellites.
But again, I am not sure, maybe just not remember well.