What you need is called “interpolation”, and there are several ways, from the easyest linear up to any higher order (quadratic, cubic, n-th order).
So here is the easy, linear interpolation.
I assume you have something like x-position and y-position (coordinates) from your gps.
You also have a (hopefully) fixed time step of 4Hz, which means 25 milliseconds between the positions.
Lets take the first position with x1 and y1, the second with x2 and y2.
Now you can calculate the position at ANY time between the two positions.
“time” should be any value from 0 to 0.25, so you need the time between 2 frames. This is also easy when you programmed a timer or fixed frame rate, else you need some way to get the elapsed time between the frames
If you want 20fps, the time between the frames is
now start from beginning with the next point (pos2 and pos3).
Get a math book, when you want to go to higher order interpolation (for smoother curve movement)
or search for “quardatic interpolation”, this should be sufficient for your needs.
Of course, the above mentioned way can be taken for ANY data you collect (roll,gear,height…)
Hope this helped!
Originally posted by dydx:
This might not be specific to opengl but I’m sure someone here has encountered this problem.
I am working a project which is basically a flight simulator. We are taking GPS position data from an aircraft and attempting to recreate it’s movements in 3D. The trouble is the position data is only refreshed at 4Hz. So basically when we simulate it directly it is like we are getting 4fps.
We need an algorithm that can basically “fill in the gaps” to give the effect of smooth motion in OpenGL. I’m sure this must have been done a million times before. And for better or worse the only resources we have are time and brain-power (no money, minimal expertise).
At the moment we are using our GPS position data to move a camera in an OpenGL world. So it would need to be the camera motion that is smoothed.
If anyone can direct me to some resource, tutorial even just a concept that could help that would be cool.