This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
NosajDraw's profile picture

GPS locate fail

Started by NosajDraw, 12 July 2012 - 11:49 AM
NosajDraw #1
Posted 12 July 2012 - 01:49 PM

Man, so little information…


Anyway, figured out that I must need 3 GPS hosts, I can't find this documented anywhere.


Then figured out that wireless modems must have a short range, I can't find this documented anywhere.


Then I just can't make it work, I've got 4 GPS hosts in range of turtle, but the turtle gets its location way off.


Finding position…

35.071358 metres from 291,174,58

34.727512 metres from 288,175,52

9.949874 metres from 290,146,58

Position is 285,140,49


Finding position…

35.071358 metres from 291,174,58

1.4142135 metres from 296,141,52

34.727512 metres from 288,175,52

Position is 293,141,46


I've checked, double checked and triple checked the locations of the GPS hosts and as far as I know they are correct.


Actual location of turtle is 295,140,51 as reflected by the "1.4142135 metres from 296,141,52"


So either I fail totally at 3D co-ords, or… or…


Help?


BTW, when I've got this handled I will update the wiki to reflect what I've learned.
xuma202 #2
Posted 12 July 2012 - 02:24 PM
From the wiki
The gps API provides a method for turtles and computers to retrieve their own locations.
It broadcasts a PING message over rednet and wait for responses. In order for this system to work, there must be at least 4 computers used as gps hosts which will respond and allow trilateration. You can set up hosts using the gps program.
Note: When entering in the coordinates for the host you need to put in the x,y,z of the modem, not the computer.

The positions of the modems need to differ in the X,Y and Z axis. Imagine you draw a sphere around the modems which radii is the distance to the turtels position is then the one where the shperes overlap. And there is only 1 intersection when you have 4 gps servers.

But from what you've posted I see the turtle only is in range of 3 gps hosts

MORE BACKGROUND INFORMATION:

When you have 1 gps host the possible positions define a sphere
When you have 2 gps host the possible positions define a circle
When you have 3 gps host the possible positions define 2 points
When you have 4 gps host the possible positions define 1 point
NosajDraw #3
Posted 12 July 2012 - 05:38 PM
Great thanks for that.

I will fix the locations since I set them as the computers, not the modems.

I have 7 GPS units in total, and checking at least 5 are in range of the turtle, but the only way I can get it to talk to them is by disabling units.

I guess this maybe because of conflicting info… I will fix and see what happens.

BTW

Is Y as I would normally expect the equivalent of latitude (and how map mods tend to show it) or is Y the depth as per how Minecraft seems to use it internally?
NosajDraw #4
Posted 12 July 2012 - 06:03 PM
Can you point to the correct wiki page? My searching is still unsuccessful.
xuma202 #5
Posted 12 July 2012 - 06:57 PM
Sure: http://computercraft.info/wiki/index.php?title=Gps_(API)

The y is the latitude.