
cheers
Gazza
Code: Select all
/* Serial GPS
only available on MEGA boards
if enabled, define here the Arduino Serial port number and the UART speed
note: only the RX PIN is used, the GPS is not configured by multiwii
the GPS must be configured to output NMEA sentences (which is generally the default conf for most GPS devices)
*/
#define GPS_SER
#define GPS_SERIAL Serial2 // should be Serial2 for flyduino v2 ... and it is for Blackvortex
#define GPS_BAUD 38400
Code: Select all
/* GPS only available on MEGA boards (this might be possible on 328 based boards in the future) if enabled, define here the Arduino Serial port number and the UART speed note: only the RX PIN is used, the GPS is not configured by multiwii the GPS must be configured to output NMEA sentences (which is generally the default conf for most GPS devices) */ //#define GPS //#define GPS_SERIAL Serial3 // should be Serial2 for flyduino v2 //#define GPS_BAUD 4800 //#define GPS_BAUD 9600
Code: Select all
Def.h only gives
[code]#if defined(GPS) #define GPSPRESENT 1 #else #define GPSPRESENT 0 #endif [/code]
Code: Select all
#if defined(GPS) GPS_SERIAL.begin(GPS_BAUD); #endif
aBUGSworstnightmare wrote:Hi there,
Nils, as already mentioned you need to do a 1:1 connection between the GPS and the Flyduino Mega.
I hope to have the connector at hands by the end of the week --> send me a PN with your address and I will mail one.
Well, I couldn't locate in the code which UART is assigned to the GPS.
Config.h only lets you chooseCode: Select all
/* GPS only available on MEGA boards (this might be possible on 328 based boards in the future) if enabled, define here the Arduino Serial port number and the UART speed note: only the RX PIN is used, the GPS is not configured by multiwii the GPS must be configured to output NMEA sentences (which is generally the default conf for most GPS devices) */ //#define GPS //#define GPS_SERIAL Serial3 // should be Serial2 for flyduino v2 //#define GPS_BAUD 4800 //#define GPS_BAUD 9600
with def.h redefines this toCode: Select all
Def.h only gives
[code]#if defined(GPS) #define GPSPRESENT 1 #else #define GPSPRESENT 0 #endif [/code]
But, were in the code is GPSPRESENT and GPS_BAUD used so far???
MultiWii.pde only hasCode: Select all
#if defined(GPS) GPS_SERIAL.begin(GPS_BAUD); #endif
but were is GPS_SERIAL assigned?
Rgds
aBUGSworstnightmare
Alexinparis wrote:Hi,
GPSPRESENT is used to set a bit in a variable (GUI communication) to indicate the presence of the GPS.
GPS_BAUD and GPS_SERIAL are defined in config.h and used in multiwii.pdeaBUGSworstnightmare wrote:Hi there,
Nils, as already mentioned you need to do a 1:1 connection between the GPS and the Flyduino Mega.
I hope to have the connector at hands by the end of the week --> send me a PN with your address and I will mail one.
Well, I couldn't locate in the code which UART is assigned to the GPS.
Config.h only lets you chooseCode: Select all
/* GPS only available on MEGA boards (this might be possible on 328 based boards in the future) if enabled, define here the Arduino Serial port number and the UART speed note: only the RX PIN is used, the GPS is not configured by multiwii the GPS must be configured to output NMEA sentences (which is generally the default conf for most GPS devices) */ //#define GPS //#define GPS_SERIAL Serial3 // should be Serial2 for flyduino v2 //#define GPS_BAUD 4800 //#define GPS_BAUD 9600
with def.h redefines this toCode: Select all
Def.h only gives
[code]#if defined(GPS) #define GPSPRESENT 1 #else #define GPSPRESENT 0 #endif [/code]
But, were in the code is GPSPRESENT and GPS_BAUD used so far???
MultiWii.pde only hasCode: Select all
#if defined(GPS) GPS_SERIAL.begin(GPS_BAUD); #endif
but were is GPS_SERIAL assigned?
Rgds
aBUGSworstnightmare
Code: Select all
const int WANTED_NUMBER = 67; // A usual GPGGA NMEA frame, 67 bytes including $;<CR>;<LF>
static uint8_t datastring [WANTED_NUMBER];
static uint32_t gpscycle;
Code: Select all
#if defined (SOME_GPS_I2C)
getData();
while (Wire.available()) {
if (GPS_newFrame(datastring [WANTED_NUMBER])){
if (GPS_update == 1) GPS_update = 0;
else GPS_update = 1;
if (GPS_fix == 1) {
if (GPS_fix_home == 0) {
GPS_fix_home = 1;
GPS_latitude_home = GPS_latitude;
GPS_longitude_home = GPS_longitude;
}
GPS_distance(GPS_latitude_home,GPS_longitude_home,GPS_latitude,GPS_longitude, &GPS_distanceToHome, &GPS_directionToHome);
}
}
}
Code: Select all
float getData ()
{
TWBR = ((16000000L / 400000L) - 16) / 2;
i2c_rep_start(0x60); //GPS sample I2c address
for (byte i = 0; i < WANTED_NUMBER; i++)
datastring [i] = i2c_readAck();
datastring [WANTED_NUMBER]= i2c_readNak();
return datastring[WANTED_NUMBER]; // maybe here we will need a terminating null
if ( (micros()-gpscycle ) < 250000 );
gpscycle = micros(); //250ms = 4Hz refresh;
getData();
}
Code: Select all
#define GPS
#define GPS_SERIAL Serial3 // should be Serial2 for flyduino v2
#define GPS_BAUD 4800
dialfonzo wrote:I need a Ferrari...!
kataventos wrote:dialfonzo wrote:I need a Ferrari...!
First the position hold then the Ferrari, one thing at a time!
Code: Select all
while (SerialAvailable(2)) {
if (GPS_newFrame(SerialRead(2))) {
Code: Select all
while (SerialAvailable(GPS_SERIAL)) {
if (GPS_newFrame(SerialRead(GPS_SERIAL))) {
mbrak wrote:Will it be possible in future to reset the home-point an set a new one without power down the copter?
Code: Select all
#if defined(GPS)
if ( (GPSModeHome == 1) && ( GPS_fix_home == 1)) {
float radDiff = (GPS_directionToHome-heading) * 0.0174533f;
GPS_angle[ROLL] = constrain(P8[PIDGPS] * sin(radDiff) * GPS_distanceToHome / 10,-D8[PIDGPS]*10,+D8[PIDGPS]*10); // with P=5, 1 meter = 0.5deg inclination
GPS_angle[PITCH] = constrain(P8[PIDGPS] * cos(radDiff) * GPS_distanceToHome / 10,-D8[PIDGPS]*10,+D8[PIDGPS]*10); // max inclination = D deg
} else {
GPS_angle[ROLL] = 0;
GPS_angle[PITCH] = 0;
GPS_fix_home =0
}
#endif
UndCon wrote:Can you try shielding things to verify it is the motors and mot ESC's that causes MAG errors?
//UndCon
Code: Select all
errorAngle = constrain(2*rcCommand[axis] + GPS_angle[axis],-500,+500) - angle[axis] + accTrim[axis]; //16 bits is ok here
Code: Select all
errorAngle = constrain(2*rcCommand[axis] - GPS_angle[axis],-500,+500) - angle[axis] + accTrim[axis]; //16 bits is ok here
Code: Select all
if (GPS_fix_home == 0) {
Code: Select all
if (rcData[AUX4]>1800) {
Alexinparis wrote:waouh !
Thank you so much for this feedback
It's a nice way to begin the year.
1) I think a small timer once the first fix is ok should be added, or maybe some averaging on 10 or 20 positions.
2) and 3) To you think the circle are caused by heading inaccuracy ? I would say it's more due to the GPS correction which is currently very simple.
Once the target GPS position is achieved, the multi will continue to drift a little with the current implementation.
A full PID could maybe do the job.
4) for inflight visual debugging purpose ?