←  Tutorials

ComputerCraft | Programmable Computers for Minecraft

»

[How to guide] GPS Global Position System

BigSHinyToys's Photo BigSHinyToys 03 Aug 2012

http://en.wikipedia....inate_systemGPS in Computer craft is a way to find Turtle or Computer positions.This guide will explain how to set up a working GPS cluster. a GPS cluster is a group of GPS server computers arranged in a way to give best accuracy and coverage.

Decription GPS Server
A GPS server is a computer with a rednet wifi modem that when asked will tell passing computers / turtles where it is its location in X , Y , Z .This combined with the distance from the sever allows a computer / turtle to locate where it is. the turtle must have this information from four different severs so it can Trilateration its location. This group of turtles is called a GPS cluster.

GPS Cluster
The way the severs are positioned has an affect on how accurate / reliable your system is. In Picture one you can see that i have computers In a pattern that pattern allows the position to be found in X Y and Z if you have four computers in a line along Y It would not be able to identify its hight or its X position. You must have computers on different locations. My recommendation is to use the below configuration I use it all the time ant it is very accurate affective and compact.
[EDIT] I derped Hard This is the Correct Picture [/EDIT]
Posted Image
Instructions
After setting up four computers in this pattern at the top of the world.Set up a startup file on each computer with the continence as the picture shown.Put this in a file named startup
shell.run("gps","host",x,y,z)
replace the x y z with numbers from the picture

Example computer A's startup file would contain
shell.run("gps","host",0,3,255)
after this reboot the computer's and repeat the process for the other three computers using the numbers from the picture.

You should now be able to check GPS coordinated from any where within a 370 Meter radius of the cluster.

For more information on the math behind GPS see http://en.wikipedia....i/Trilateration
For more information on coordinate systems see http://en.wikipedia....ordinate_system

Testing

Option A
Make a turtle with wifi and run gps locate. it should show position. use go to move the turtle and check again with gps locate

Option B
Download [CC_1.41] BENCH v1.3 multi porous testing utility using Turtle Driver option press "g" to check for GPS location.

I hope this was helpful as the GPS system is extremely useful.

GPS builder program
neonerz has created a automatic build script for GPS satellites
http://www.computerc...-gps-deploy-10/
Quote

Keaton's Photo Keaton 03 Aug 2012

This is a very nice tutorial for the gps. But, what can we really do with it? Does it have more applications other than finding a location?
Quote

ReconTurtle's Photo ReconTurtle 03 Aug 2012

The rednet GPS is mostly used to find the position of a computer (or turtle). Using this information, it's a lot easier to control your turtle or make him go to a specific location. It's a very useful system if you want to take advantage of wireless turtles.
Quote

BigSHinyToys's Photo BigSHinyToys 03 Aug 2012

ReconTurtle is right it allows you to know where placers are and to send turtles there example to explode stuff. also if you have more than one turtle then this allows all turtles to communicate there position in a format they know . meaning each turtle doesn't have different ideas on where it is.
Quote

PixelToast's Photo PixelToast 03 Aug 2012

you only need 3 computers, if you look at the gps code it can narrow a position based on only 3 positions and distances
also i have a program to scramble or crash recon turtles so PM me if you plan on having a huge turtle battle
Quote

ChunLing's Photo ChunLing 03 Aug 2012

The GPS api itself doesn't do anything other than figure out positions based on existing positions, but your turtles can also act as GPS hosts themselves once they get their own positions. Because they can also transmit rednet wireless messages, it means that you could have all the turtle positions sent back to a central console from which you can see where they all are, and could even give them new orders on the fly (so to speak).
Quote

BigSHinyToys's Photo BigSHinyToys 03 Aug 2012

View Postabc, on 03 August 2012 - 07:12 PM, said:

you only need 3 computers, if you look at the gps code it can narrow a position based on only 3 positions and distances
also i have a program to scramble or crash recon turtles so PM me if you plan on having a huge turtle battle
I have tried with only three and get mixed if best results you are right for spherical trigonometry all you need is three But given CC's double floating point the math cant determent with accuracy its position so uses a fourth to make final confirmation.

this was tested in ver 1.3 so maybe it has been improved in 1.41 If you could test that three configuration I would be appreciable.
[EDIT]
Made a new test world built and tested antenna as seen in opening post all worked . turned off one computer and it shows this. proving it needs at least four for locating its position
[With three GPS server's on]
Posted Image
[with four GPS server's on]
Posted Image
[/EDIT]
Quote

TntTerminal's Photo TntTerminal 26 Aug 2012

Computercraft uses computers to trangulate positions, but in real life there are satelites do that so it covers the whole planet... This would be impossible in minecraft because the minecraft world is infinite (not really, it is about millions times the surface of earth because of 8-bit math).
Quote

ThinkInvisible's Photo ThinkInvisible 28 Aug 2012

What we need is some sort of signal booster block. Possibly a powerful relay block that only transmits in a straight line?

Also, I think if the computers are spread out and none of the positions are similar then the computers only need three coordinates. You have two of them at 0 in that picture, which doesn't tell the turtle as much.

How it works:
The rather messy diagram below shows GPS A, GPS B, and GPS C - three computers on a 2D plane sending their distance from a Turtle. the Distance labels are the radiuses of each circle, the iX labels are intersections of the circles.
Posted Image
GPS A responds with Distance A, putting the turtle anywhere on the green circle.
GPS B responds with Distance B, meaning the turtle has to be on the green AND blue circles. This could put it at either iA or iD - still not enough info.
GPS C responds with Distance C, meaning the turtle has to be on ALL circles. The only option is iD - the turtle must be there. The turtle realizes this and tells itself that it is there through some serious complicated math.
Quote

immibis's Photo immibis 29 Aug 2012

Yes, you need three computers in two dimensions. But you need four in three dimensions.
Quote

BigSHinyToys's Photo BigSHinyToys 29 Aug 2012

This is a Experimental and possibly bug riddled code

GPS builder turtle program.

This program sends a turtle up as far as it can go then builds a GPS cluster


Instructions < Reed

[WARNING] This is experimental code there are probably bugs and errors in it you may loose items when using this. I give no Warner to this code. use at your own risk

if you already have working GPS in your world DON'T USE THIS it will cause you a Big problems

I would recommended tying this out in a New creative world before using it in a real survival world so you know what is does.

place a turtle can be mining or normal WIFI not required.


place turtle with a clear path to the sky (no trees or obstacle above it)

add 600 fuel (one bucket of lava is 1200)
add 4 computers to slot 1
add 4 wifi modems to slot 2
If you are using a Mining turtle then you only need one disk drive in slot 3 and you will get it back. if you are not using a mining turtle then you will need four disk drives in slot 3
place a BLANK disk in slot 4


RUN this program.
http://pastebin.com/gLTwfr8V

press Enter when you have it set up correctly and it will fly up into the sky place Computers turn them on and comeback down.

There is no back door into the computers so ounce they are up there they are staying there you can edit there code after this.

all going well your turtle returns with the disk to ground level. Report bugs here and I will hunt them down.
Quote

FuzzyPurp's Photo FuzzyPurp 29 Aug 2012

Nice work BST- alot of people will appreciate this, including myself.
Quote

BigSHinyToys's Photo BigSHinyToys 29 Aug 2012

View PostFuzzyPurp, on 29 August 2012 - 07:13 PM, said:

Nice work BST- alot of people will appreciate this, including myself.
Thanks. When I have cleaned it up and hardened it against mob interference I will release a more stable version. for now the warnings are still relevant (as no check for movement are made) . I have used it in SSP and it worked fine.
Quote

FuzzyPurp's Photo FuzzyPurp 04 Sep 2012

I think Direwolf used your design in his SMP-LP ep 51 :D/>
Quote

DarkSnake's Photo DarkSnake 04 Sep 2012

View PostFuzzyPurp, on 04 September 2012 - 11:21 AM, said:

I think Direwolf used your design in his SMP-LP ep 51 :D/>
He did! :P/>
Quote

BigSHinyToys's Photo BigSHinyToys 05 Sep 2012

That video is so lol. I think it is this design.
Quote

Slye's Photo Slye 07 Sep 2012

Thanks for the guide. :D/>

When I tried this I saw the note "at the top of the world". Never mind for a moment that you call the up down axis Z (which is cartesian coords as I learned them) and minecraft calls this Y...I went up to about Y=250 and placed this GPS server set up. When I got back down and tried "gps locate" in a computer, it was unable to receive anything from the servers.

I went looking and found this in configs/mod_ComputerCraft.cfg:

modem_range=64

When I changed this to 192, everything worked and I was able to "gps locate". So I'm wondering how you got this server farm to work? Am I missing something important like wraparound vis 8-bits or something?
Quote

BigSHinyToys's Photo BigSHinyToys 07 Sep 2012

View PostSlye, on 07 September 2012 - 04:32 AM, said:

Thanks for the guide. :D/>

When I tried this I saw the note "at the top of the world". Never mind for a moment that you call the up down axis Z (which is cartesian coords as I learned them) and minecraft calls this Y...I went up to about Y=250 and placed this GPS server set up. When I got back down and tried "gps locate" in a computer, it was unable to receive anything from the servers.

I went looking and found this in configs/mod_ComputerCraft.cfg:

modem_range=64

When I changed this to 192, everything worked and I was able to "gps locate". So I'm wondering how you got this server farm to work? Am I missing something important like wraparound vis 8-bits or something?

you are not using the most resent version of computer craft. Computers range increases the higher they are. also dan200 doesn't recommend using the "real world" coordinates and recommends that "Relative coordinates" be used instead. the reason that minecraft uses Y for the X axis is because it allows the game to some rendering shortcuts saving CPU time. I might add that the F3 is for debugging not for finding location and will most likely be removed in time.
Quote

Slye's Photo Slye 07 Sep 2012

View PostBigSHinyToys, on 07 September 2012 - 05:04 AM, said:

you are not using the most resent version of computer craft. Computers range increases the higher they are. also dan200 doesn't recommend using the "real world" coordinates and recommends that "Relative coordinates" be used instead. the reason that minecraft uses Y for the X axis is because it allows the game to some rendering shortcuts saving CPU time. I might add that the F3 is for debugging not for finding location and will most likely be removed in time.

Relative coordinates? So ... where do you get those if not from the information in F3?

Do you mean keeping track of where your turtle moves and letting the origin be where you started the turtle?
Quote

BigSHinyToys's Photo BigSHinyToys 07 Sep 2012

View PostSlye, on 07 September 2012 - 05:22 AM, said:

Relative coordinates? So ... where do you get those if not from the information in F3?

Do you mean keeping track of where your turtle moves and letting the origin be where you started the turtle?
You chose where the coordinates start then all other coordinates are relative to that. I make the origin bellow my main base normally. Origin being the point where x y and z are 0 this is bellow my main house. you also chose what direction is north. I normally pick the front of my house. I pick the top of the world as Z 255 and then make all other GPS towers with in GPS range and just get the coordinates for them from using gps locate. basically you chose where and what the coordinates are. you can use Y or Z for up and down it is all up to you. for simplicity sake I just go with Z is up down as that is how i learned it before I started using CC and it could be argued that it is the right system.
Quote