Sign in to follow this  
Varmint007

great circle revisited

Recommended Posts

Trying to plot a course between 2 sets of coordinates Lat1 = (A:GPS POSITION LAT, radians)Lon1 = (A:GPS POSITION LON, radians)And a point selected by the pilot (lat & lon) Searched through the forum

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

If you're just trying to get the bearing to the second set of coodinates, this should help.(*INPUT: LAT1,LON1,LAT2,LON2*) @1 sin @3 sin * @1 cos @3 cos * @2 @4 - cos * + acos (*INPUT: LAT1,LON1,LAT2,LON2*)pi 2 * @3 sin @1 sin @GC_DISTANCE(@1, @2, @3, @4) s0 cos * - @1 cos l0 sin * / acos @4 @2 - sin 0 < if{ - } els{ + } rddg dnor dgrdIn order to get the bearing, you need the GC distance. So in this set of macros, calling CG_BEARING will automatically get the distance for you. Of course you can also use CG_DISTANCE independently if needed.All inputs and results are in rads. Note that I avoided the 'rnor' function, since it seems to be broken. Instead use rddg dnor dgrd, or skip the dgrd if you want your results in degrees.This is the direct course to the second set of coordinates following a great circle, so if you want to account for wind drift you'll need to plug in the appropriate correction.

Share this post


Link to post
Share on other sites

Hi Ridgell,I would recommend to use the gps calls as their calcs must be the same used by FS engine to plot course/distance:C:fs9gps...(L:YourLatitudeFrom,degrees) (>@c:GeoCalcLatitude1,degrees) (L:YourLongitudeFrom,degrees) (>@c:GeoCalcLongitude1,degrees) (L:YourLatitudeTo,degrees) (>@c:GeoCalcLatitude2,degrees) (L:YourLongitudeTo,degrees) (>@c:GeoCalcLongitude2,degrees) (@c:GeoCalcBearing,degrees) (>L:FromToBearing,degrees)(@c:GeoCalcDistance,nmiles) (>L:FromToDistance,nmiles)...That's it -no need to manage complex calcs :-)Tom

Share this post


Link to post
Share on other sites

great moogally boogally!here i was digging away with my hands and you guys show up with a back hoe and a steam shovel. tom trying the gps vesion 1st, *seems easier* (L:YourLatitudeFrom,degrees) would be the (A:GPS POSITION LAT,degrees) and the (L:YourLatitudeTo,degrees) would be the user input latitude,degrees etc?

Share this post


Link to post
Share on other sites

Hi,Right, i use (A:PLANE LATITUDE,degrees) and (A:PLANE LONGITUDE,degrees) and (@c:GeoCalcBearing,degrees) (A:MAGVAR,degrees) - (>K:HEADING_BUG_SET) Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

yes, it comes 1st in the sdk "position & speed" is before "avionics & gps" but in my forum searching for lat lon and GC route, i came across a post where some was complaining about (A:PLANE LATITUDE,...) because FS was dividing it by something, it was a little over my head, but i switched Vars just in case, but you say it is the same or better, i will take your word.

Share this post


Link to post
Share on other sites

Ridgell,I prefer to use Plane Latitude because it updates on every cycle instead of GPS Positiom AVar that updates every three cycles. Haven't found any trouble so far. As Jan stated, bearing is a True North reference then you must substract MagVar to obtain magnetic info.Tom

Share this post


Link to post
Share on other sites

Those GPS calcs are a great resource/performance saver, but I only use them in instances where I don't need continuous updates. The slow iteration rate of the GPS calls make for some pretty choppy indications, particularly if there's graphics associated with it.So there's definitely advantages to the sledge-hammer approach (at least in my stuff), but hopefully Ridgell can get by with the GPS calls. They ARE much cheaper if the slower speed is acceptable.

Share this post


Link to post
Share on other sites

Jon,GeoCalc functions can be called more than once in a gauge, and they return their values immediately, so there is no penalty in their use. Which IS slow is the A:GPS... set of avar's values. That's the reason for me to use Plane Lat/Lon values present and past, combined with the GeoCalc calls to obtain the a/c tracking/bearing on each cycle.Tom

Share this post


Link to post
Share on other sites

i am attempting to simulate an internal navigation system, one of the 60s-70s types that were gyro driven, the out put will be digital and an RMI/ADF type gauge, speed is not an issue as the course should not experiance rapid change, and the display on the analog gauge has a built in delay, magnetic variation will also not apply as the system is independent of the mag compass. the spin gyros were not accurate to land with, just good enough to get you within eye shot. they could be accurate if you gave them a long enough spin up...we never did! peace time flying for NATO was doled out as Hobbs time and to precious to use sitting on the tarmac.

Share this post


Link to post
Share on other sites

Ah, interesting, Tom! I knew the PLANE LAT/LON responded at the gauge refresh rate, but I foolishly assumed the ALL the GPS calls were similarly gimped. I must have used the GPS LAT/LON last time I tried it. Either that or something else was bottlenecking the result. I'll give it a revisit.

Share this post


Link to post
Share on other sites

Now that's a cool project. Please keep us posted with how it's working out.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this