Re: [Flightgear-devel] Determining range?

2005-09-18 Thread Harald JOHNSEN

Dave Culp wrote:


... how do I get the distance from
my current Lat/Long to another Lat/Long? 
   




There's a function in SimGear that does this.  See 
SimGear/simgear/math/sg_geodesy.cxx for a function called int 
geo_inverse_wgs_84()



This may be overkill for your application.

Dave

 

Don't forget to check the reference : 
http://williams.best.vwh.net/avform.htm (Aviation Formulary )


Harald.



___
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d


Re: [Flightgear-devel] Determining range?

2005-09-18 Thread Paul Surgeon
On Saturday 17 September 2005 23:48, Mike Kopack wrote:
 Hey gang,

 As part of my simulated UAV control system project, I needed to augment the
 built in Autopilot system in FG with a module in my own system (which is
 written in java) that takes the aircraft's current position, and a desired
 position (lat/long/altitude/desired arrival time) and figures out the
 proper autopilot heading to lock to and altitude locks etc.

 Now, I'd like to figure out how to handle that last variable: Arrival time.
 To do it, I need to know how far I have left to travel, and how long I have
 to get there. The time isn't a problem, but how do I get the distance from
 my current Lat/Long to another Lat/Long? My investigations online show that
 there's no real way to directly convert from Lat/Long to meters. I know
 that the GPS system in FG calculates this distance. I just need to know
 what the formulas are that are used to arrive at this distance.

Hi Mike

Take a look at Aviation Formulary V1.42
http://williams.best.vwh.net/avform.htm

It has everything you'll ever need formula wise for great circle navigation.
Distance, initial course, cross track error, working out an enroute point at x 
distance from the origin along the route, etc
It uses a spherical earth model which means there is a maximum error of about 
0.2% which should be acceptable if I'm not mistaken.

There is a worked examples section.

Distance between points

d=2*asin(sqrt((sin((lat1-lat2)/2))^2 + 
 cos(lat1)*cos(lat2)*(sin((lon1-lon2)/2))^2))

The distance from LAX to JFK is
===
d = 2*asin(sqrt((sin((lat1-lat2)/2))^2+
   cos(lat1)*cos(lat2)*(sin((lon1-lon2)/2)^2))
  = 2*asin(sqrt((sin(0.592539-0.709186)/2))^2+
   cos(0.592539)*cos(0.709186)*(sin((2.066470-1.287762)/2)^2))
  = 2*asin(sqrt((-0.05829)^2 +0.829525*0.758893*0.379591^2))
  = 2*asin(0.306765)
  = 0.623585 radians
  = 0.623585*180*60/pi=2144nm
 or
d = acos(sin(lat1)*sin(lat2)+cos(lat1)*cos(lat2)*cos(lon1-lon2))
  = acos(sin(0.592539)*sin(0.709186)+
 cos(0.592539)*cos(0.709186)*cos(0.778708))
  = acos(0.811790)
  = 0.623585 radians
  = 0.623585*180*60/pi=2144nm

The initial true course out of LAX is:
==
   sin(-0.778708)=-0.7020 so

   tc1 = acos((sin(lat2)-sin(lat1)*cos(d))/(sin(d)*cos(lat1)))
   = acos((sin(0.709186)-sin(0.592539)*cos(0.623585))/
(sin(0.623585)*cos(0.592535))
   = acos(0.408455)
   = 1.150035 radians
   = 66 degrees  


Regards
Paul

___
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d


Re: [Flightgear-devel] Determining range?

2005-09-17 Thread Dave Culp
 ... how do I get the distance from
 my current Lat/Long to another Lat/Long? 


There's a function in SimGear that does this.  See 
SimGear/simgear/math/sg_geodesy.cxx for a function called int 
geo_inverse_wgs_84()


This may be overkill for your application.

Dave

___
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d