Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Calculating GPS location movement from A to BBBBBB i,e,not in a straight line.

Status
Not open for further replies.

camerart

Well-Known Member
Hi,
I'm trying to learn how to calculate between GPS locations, as in how a radio control model moves.

The project I'm working on, moves a location around by using joysticks, which is translated into GPS LAT/LON locations, as the joysticks are moved. The model (REMOTE) follows these fast moving locations, in a similar manor to conventional RC models.

The reason for this unusual method is due to eye sight and the inability to know which way my models are aiming, so I crash them for safety. This method would allow me to aim the model towards, me and fly forward in my direction.
It has been in development for 5-6 years, and the time has at last come for the location calculations.

Any help welcome.
Cheers, Camerart.
 
Last edited:
Trigonometry!

You know the actual location and target, in X Y coordinates; eg east-west for X and north-south for Y.
Decide on and use some fixed unit scale that gives adequate positional accuracy, like 0.01 arc seconds or 0.0001 arc minutes

You will need 32 bit maths, or possibly double precision floats for really high precision.

Take the difference in X and the difference in Y
Call those dX and dY

Calculate straight-line radial distance; Pythagoras theorem: R = Square root ((dX * dX) + (dY * dY))

Divide the X & Y differences by the radial distance:

SX = dX / R

CY = dY / R

That should give two fractions which are the sine and cosine of the absolute bearing angle.

Arcsin(SX) & Arccos(CY) should both give that angle; if they are within a few percent of each other average them as the final result. If they are very different, ignore that calculation and try the next set up values.


If!! I've got all that correct, from memory..
 
Trigonometry!

You know the actual location and target, in X Y coordinates; eg east-west for X and north-south for Y.
Decide on and use some fixed unit scale that gives adequate positional accuracy, like 0.01 arc seconds or 0.0001 arc minutes

You will need 32 bit maths, or possibly double precision floats for really high precision.

Take the difference in X and the difference in Y
Call those dX and dY

Calculate straight-line radial distance; Pythagoras theorem: R = Square root ((dX * dX) + (dY * dY))

Divide the X & Y differences by the radial distance:

SX = dX / R

CY = dY / R

That should give two fractions which are the sine and cosine of the absolute bearing angle.

Arcsin(SX) & Arccos(CY) should both give that angle; if they are within a few percent of each other average them as the final result. If they are very different, ignore that calculation and try the next set up values.


If!! I've got all that correct, from memory..
Hi R,
Thanks for the memories.

I think I've got two ways of doing this, if I test the first one.

1x joystick is FORWARD/BACKWARD, this would increment the LAT, UP/DOWN.
1x joystick is LEFT/RIGHT, this would increment the LON, UP/DOWN.

E,G
4444.44444
4444.44446
N or S

and
22222.22222
22222.22224
E or W.

Here is a grid (not to any scale) (left side) showing 2x increments for LAT and LON.
In this case the angle between A and B is 45DEG.

Is this the correct way to start?
C.
EDIT: I've thought this through the best I can and I don't think it works, because the movement is dictating the angle between A and B, and it should be BASE dicy#tating it!
 

Attachments

  • LAT LON.png
    LAT LON.png
    30.7 KB · Views: 235
Last edited:
Hi,
I've asked the above question on a few other forums, and haven't received many answers that lead anywhere. I think this is more complicated than it at first looks.

I think there are 2x ways of doing this.
1/Using a rotator knob on the BASE station, so that e,g, if aimed at 45° would give the angle between A and B.
2/ Use the LAT/LON joysticks as shown in #3. This would slide the desired location around the 'map' This uses no Trigonometery calculations (at the moment)

So far when thinking through this, I always come up with, let's call it a discomfort.
Using 2/ If the BASE is looking North, then all's fine, until the REMOTE goes South of BASE, or BASE turns to face South. In these cases the joysticks still move N/S and E/W , but it seem upside down.

Anyway, I'll go with 2/ for a while and try some 'live' tests, to see how I get on.
C
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top