• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

Where can i find a formulae for increment a lat-lon position?

Messages
175
Country
panama
Hi,

I just wanted to know if anyone, know a place where i can find a formulae for extrapolate a lat-lon position?.

Example, my aircraft's current position is:

latitude: 9.45678 (in degrees units)
longitude: -89.234324 (in degrees units)
altitude: 2000 (in feet units)

the aircraft is flying with this velocity:

north velocity: 100 feet/second
east velocity: 100 feet/second
vertical velocity: 500 feet/second

How can i get the increments to add to the current position so i get the new position of the aircraft? if delta time is 0.25 seconds?....

This is more like a physic or math question, but i do really need this formulae.

Best Regards,

Manuel Ambulo
 
Messages
156
Country
france
My method (which is probably not the best) would be :

- convert "north" and "east" speeds (respectively vx and vy) to angular velocity (wx and wy) :
wx = vx / (R +alt)
with R the radius of Earh (use same units, ie feets here) and alt current altitude above ground. wx will be in rad/seconds, so convert it to deg/s if you are working with degrees coordinates.

- For each time frame, increment position using this angular velocity. The formula for calculating position between two frames will be:
x(t+dt) = x(t) + wx * dt
With dt the time between two frames.
and same for y(t+dt). If you are working into a simconnect event or similar, you would probably calculate dt manually (time difference between each frame) since it can vary slightly for each frame.

For the "Z" altitude axis, no need to convert speed to angular velocity.

However, I don't know how FS will react to this. The object you are simulating will probably looks like "jumping" from one position to another if the speed is too fast. And you need to calculate pitch/bank/heading angles to get a realistic motion.

I have also this kind of problem actually for an addon I'm programming, and I really think
that the best solution is to let FS do the simulation job. Either setup an aircraft simobject
container for your object and use it's flight dynamic with waypoints, or use slew motion.
When in slew, you only need to send the value of velocity on each axis and FS will calculate the position.
 
Messages
175
Country
panama
My method (which is probably not the best) would be :

- convert "north" and "east" speeds (respectively vx and vy) to angular velocity (wx and wy) :
wx = vx / (R +alt)
with R the radius of Earh (use same units, ie feets here) and alt current altitude above ground. wx will be in rad/seconds, so convert it to deg/s if you are working with degrees coordinates.

- For each time frame, increment position using this angular velocity. The formula for calculating position between two frames will be:
x(t+dt) = x(t) + wx * dt
With dt the time between two frames.
and same for y(t+dt). If you are working into a simconnect event or similar, you would probably calculate dt manually (time difference between each frame) since it can vary slightly for each frame.

For the "Z" altitude axis, no need to convert speed to angular velocity.

Thanks very much, lc0277...:) . I also has a question, eeh the what is the radius of the earth?,...i think that value is in the Scenery SDKs, of i think in the FS2002 SDKs, but dont know where it is...i know that i can search the web and find it, but if u have that value "in the hand" (just next to you), i would appreacite if you could give it to me....:eek:..(sorry by the inconvence...but again thanks very much for the formulae)

About converting the rad/seconds to degrees/second, i think that i should use:

angle_degrees=(180/pi)*angle_radians

to convert to degrees/second right?...i others words:

wx_deg = (180/pi)*wx_rad

the "wx_rad" is the same result i get from the:

wx = vx / (R +alt)

Another thing, the alt in the above formulae, can i use the altitude provided by the "PLANE ALTITUDE" variable (found in the SIMULATION VARIABLES list?)...Im asking because the add-on im working in, gets part of the information from FS2002/2004 multiplayer packet send from others Flight Simulators...and it pickups the altitude from there...but i can modify it in a way so it can also send the altitude above the ground (AGL), but before doing that modification (which takes time to do...hehehe)...just wanted to be sure that if it MUST BE AGL (above ground), or it can be the altitude of the aircraft MSL (mean sea level)...

About delta time (dt) i can get it from an event that i can suscribe to the SimConnect server, which can return the visual frame rate, so then i just do: (1/fps), and it should give the delta time in seconds, of the current visual frame rate which varies....


I have also this kind of problem actually for an addon I'm programming, and I really think
that the best solution is to let FS do the simulation job. Either setup an aircraft simobject
container for your object and use it's flight dynamic with waypoints, or use slew motion.
When in slew, you only need to send the value of velocity on each axis and FS will calculate the position.

Yes, the best solution is giving to the AI aircrafts the waypoints, but im working the add-on based in multiplayer, so i dont have more choices to just create the aircrafts movements by my own (from the add-on), thats why i need to extrapolate the position every certain time until it arrives a new packet from the remote aircraft, telling the new position and current velocity...


A BIG THANKS, lc0277,

Best Regards,

Manuel Ambulo
 
Messages
36
Country
spain
I don't know the exact web but Google for GFC or GFCSharp. They are C++ and c# libs and both have that function (and many others, with source code).

Best Regards,
Javier.
 
Messages
156
Country
france
I also has a question, eeh the what is the radius of the earth?,...i think that value is in the Scenery SDKs, of i think in the FS2002 SDKs, but dont know where it is.
I personnally use 6378137 meters, which is close to values you can find on the web. But remember that the Earth on FSX is not round, it's ellipsoid. Consequently, radius is not constant. In many applications, the approximation error is insignificant, but I don't know exactly how much. It will probably not be noticeable for such "little" variations.

angle_degrees=(180/pi)*angle_radians
wx_deg = (180/pi)*wx_rad
correct

Another thing, the alt in the above formulae, can i use the altitude provided by the "PLANE ALTITUDE" variable (found in the SIMULATION VARIABLES list?)...
Yes, it's the plane altitude above "earth radius", meaning sea level, invariant of altimeter settings and so PLANE ALTITUDE is good.

Yes, the best solution is giving to the AI aircrafts the waypoints, but im working the add-on based in multiplayer, so i dont have more choices to just create the aircrafts movements by my own (from the add-on), thats why i need to extrapolate the position every certain time until it arrives a new packet from the remote aircraft, telling the new position and current velocity...

Slew mode could be also a good choice.
In slew mode, you only send values of speed on each axis, so the simulator will continue
to animate planes even if it did not receive values for a long time. No need to calculate position, just feed speed & direction of movement. The main problem will be to convert plane speed values to slew axis values, which are not linear :eek:
 
Messages
175
Country
panama
Hi,

Thanks VERY MUCH guys, i got it working i mean, i got the way to move an AI aircraft updating it's position every visual frame, and it move just fine, i need just a few tests, but from what i can see, it works very nice, so again THANKS, lc0277 and Javier. I tried using SLEW, but when i wanted to set things like FLAPS, SPOILERS or any moving part, they dont move during SLEW mode, so i chose by extrapolating every visual frame until a new position/velocity packet arrives...so THANKS again :)

Best Regards,

Manuel Ambulo
 
Top