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

GPS Api 101

Started by eddieo, 30 June 2012 - 12:44 PM
eddieo #1
Posted 30 June 2012 - 02:44 PM
Hey all another little tutorial to show how to set up the gps api. What you are going to need is at least 4 computers each with a modem and a disk drive. Now place 4 of the computers in the corners of a large square 50 x 50 I'm not sure how big it can be but 50 x 50 should work. I named my computers Host A through Host D. Ok now to set up the hosts. Attach a modem to the right side and a disk drive to the left. Insert a floppy disk in each then create a file on the floppy and name it startup. in each startup file put this code

rednet.open("right")
shell.run("gps", "host", x, y, z)
The first line opens the modem for use.
The second line sets up the host. The x, y, and z are the hosts location. To get its location stand on the computer and press F3 use the x, y, and z that is displayed. Subtract 1 from y because you were standing on the computer.
When you have all this finished reboot the host and it should come up with

Position is X, Y, Z
Serving GPS Requests


Now every time you start Minecraft you GPS system is up and running. A boot disk was the simplest way to achieve this with out editing the main startup files.

Ok now to test it on a wireless turtle. Use the following code


term.clear()
term.setCursorPos(1, 1 )
rednet.open("right")
cx,cy,cz = gps.locate(10)
rednet.close("right")
print(os.getComputerLabel())
print("Current Position is")
print("X = ",cx)
print("Y = ",cy)
print("Z = ",cz)

if all the above was done correctly the turtle should be displaying its name(if you gave it one) and its x, y, and z location.

After much testing and hair pulling I Discovered that all the GPS Computers and Turtles have to be at the same height or y position to Communicate with each other.
Noodle #2
Posted 01 August 2012 - 04:26 PM
Nice tutorial.. But are you sure they have to be on the same Y? I believe 1.4 fixed that?
eddieo #3
Posted 14 August 2012 - 09:39 AM
it says it did i haven't tested it yet
BigSHinyToys #4
Posted 14 August 2012 - 12:04 PM
They don't need to be at the same Y you are doing it wrong Look at my tutorial
[How to guide] GPS Global Position System

Any device with WIFI within a 376 meter radius sphere can find its location. Having the transmitter far apart creates a larger Grey Zone around the area where WIFI can only communicate with three or less towers.