




Quote:
If we assume coordinates from your screen are exactly as they would be displayed by an Orginal GOSD then they are 5824.8422, 1536.0478 and becomes 58.248422, 15.360478 The degree part remains intact, and the calculation are for mins part: (248422*100)/60 = 414036 (360478*100)/60 = 600796 so the result is 58.414036, 15.600796 and google says you are in Linkoping, Sweden. 






I do think LONG PRESS is more suitable because first fix can be way too wrong if you acquired only few satellites, and also are doing other magics over the plane.






Quote:
do you have an ETA about the home arrow thing ? BTW  once you do set home, in flight a LOS distance from home would be extremely helpful. 






Quote:
Code:
int bearing(float flat1, float flon1, float flat2, float flon2) { float heading; flon1 = radians(flon1); //also must be done in radians flon2 = radians(flon2); //also must be done in radians flat1 = radians(flat1); //also must be done in radians flat2 = radians(flat2); //also must be done in radians heading = atan2(sin(flon2flon1)*cos(flat2),cos(flat1)*sin(flat2)sin(flat1)*cos(flat2)*cos(flon2flon1)),2*3.1415926535; heading = heading*180/3.1415926535; // convert from radians to degrees int head =heading; //make it a integer now if(head<0){ heading+=360; //if the heading is negative then add 360 to make it positive } return heading; } Code:
void servo_move(int desthead, int myhead) { float angle; int serv; angle=(((((desthead  myhead) % 360) + 540) % 360)  180); angle=angle; if (angle>90) { angle=90; } else if (angle<90) { angle=90; }; myServo.write(90+(int)angle); } 






schumixmd: Thanks for the code! But i think I need to do the calculations without float since I'm already using 80% of the program space and float takes a lot of space. But with this I should get started at least.
Q: Do you use the GPS angle data to calculate the home arrow? I think I will use my arduino to feed GPS data to the GOSD for testing so I don't have to run around outside. 





and here is code for calculate distance between 2 points(source from TinyGPS library for Arduino)
Code:
/* static */ float TinyGPS::distance_between (float lat1, float long1, float lat2, float long2) { // returns distance in meters between two positions, both specified // as signed decimaldegrees latitude and longitude. Uses greatcircle // distance computation for hypothetical sphere of radius 6372795 meters. // Because Earth is no exact sphere, rounding errors may be up to 0.5%. // Courtesy of Maarten Lamers float delta = radians(long1long2); float sdlong = sin(delta); float cdlong = cos(delta); lat1 = radians(lat1); lat2 = radians(lat2); float slat1 = sin(lat1); float clat1 = cos(lat1); float slat2 = sin(lat2); float clat2 = cos(lat2); delta = (clat1 * slat2)  (slat1 * clat2 * cdlong); delta = sq(delta); delta += sq(clat2 * sdlong); delta = sqrt(delta); float denom = (slat1 * slat2) + (clat1 * clat2 * cdlong); delta = atan2(delta, denom); return delta * 6372795; } 





Quote:
No, adn Yes. The code I wrote above. Home arrow is calculated by function bearing. It takes 4 parametes LAT,LON for HOME and LAT,LON for current location. Then Yes, using course provided by GPS and Course I must follow I move the servo to the left or right 90degree, but if you omit IF statement then you have 180 degree right and 180 left. The formula for angle I borrowed from a games programming forum, and is the shortest and easiest one. there were another versions with more computation. 


Last edited by schumixmd; Aug 18, 2011 at 05:54 AM.





Quote:
However .. that code I provided with a lot of other not very well tuned code worked in my arduino with atmega328.. way bigger than EOSD 



Thread Tools  
Similar Threads  
Category  Thread  Thread Starter  Forum  Replies  Last Post 
Build Log  Super OSD ($90): Open Source Graphic OSD: Vario, 6xADC, Games, Datalog, Dual Video  tom66  FPV Equipment  1928  May 24, 2014 12:07 PM 
Discussion  Open Source Remote Control System (OSRC)  Gizmoman31  Radios  152  Apr 24, 2012 07:01 PM 
Discussion  Open source OSD for FPV  UFO_MAN  FPV Talk  75  Sep 07, 2011 03:03 PM 
Question  Open Source Octo Design Available...Looking for someonw who can cut a copy for me...  Schatham421  Multirotor Talk  14  Apr 12, 2011 06:22 PM 