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

[How to guide] GPS Global Position System

Started by BigSHinyToys, 03 August 2012 - 07:38 AM
BigSHinyToys #1
Posted 03 August 2012 - 09:38 AM
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]

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.computercraft.info/forums2/index.php?/topic/9528-gps-deploy-10/
Keaton #2
Posted 03 August 2012 - 04:02 PM
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?
ReconTurtle #3
Posted 03 August 2012 - 05:13 PM
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.
BigSHinyToys #4
Posted 03 August 2012 - 05:23 PM
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.
PixelToast #5
Posted 03 August 2012 - 08:12 PM
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
ChunLing #6
Posted 03 August 2012 - 08:47 PM
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).
BigSHinyToys #7
Posted 04 August 2012 - 12:28 AM
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]

[with four GPS server's on]

[/EDIT]
TntTerminal #8
Posted 26 August 2012 - 07:24 PM
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).
ThinkInvisible #9
Posted 28 August 2012 - 01:46 PM
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.

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.
immibis #10
Posted 29 August 2012 - 11:06 AM
Yes, you need three computers in two dimensions. But you need four in three dimensions.
BigSHinyToys #11
Posted 29 August 2012 - 12:50 PM
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.
FuzzyPurp #12
Posted 29 August 2012 - 08:13 PM
Nice work BST- alot of people will appreciate this, including myself.
BigSHinyToys #13
Posted 30 August 2012 - 12:41 AM
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.
FuzzyPurp #14
Posted 04 September 2012 - 12:21 PM
I think Direwolf used your design in his SMP-LP ep 51 :D/>/>
DarkSnake #15
Posted 04 September 2012 - 06:52 PM
I think Direwolf used your design in his SMP-LP ep 51 :D/>/>
He did! :P/>/>
BigSHinyToys #16
Posted 05 September 2012 - 02:00 AM
That video is so lol. I think it is this design.
Slye #17
Posted 07 September 2012 - 05:32 AM
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?
BigSHinyToys #18
Posted 07 September 2012 - 06:04 AM
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.
Slye #19
Posted 07 September 2012 - 06:22 AM
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?
BigSHinyToys #20
Posted 07 September 2012 - 07:14 AM
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.
KelticRaven #21
Posted 20 November 2012 - 09:04 AM
Hey BigSHinyToys,

I am working on a way to allow an Airship to move via the Cartesian Coordinate system and it came to me that perhaps a Computer from Computer Craft would be able to talk to a GPS system to do so. IE: the computer asks for a target location via XYZ coordinates, then calculates it's current location and then slowly move (the only way you can move with Frame Motors) from point A to point B.

1) Do you think that is possible?
2) What would be the best way to implement said system?

I assume that we would need to set up at least 1 GPS system, if not more then one… say about 4. Each station with a full 4 rig setup and have them talk to each other via the RedNet system already in the world. With at least one full on HOST system setup in the GPS Ring. Looking at the above image of the overlapping GPS rings would show how a multiple GPS system would allow for longer distances to be reached/mapped.

I understand that it would take some time to program this… in fact I already have a working check list started on this very subject. I would welcome any input you could provide. Thank you in advance for your time &amp; assistance on this matter.

KelticRaven
BigSHinyToys #22
Posted 20 November 2012 - 10:07 AM
@KelticRaven

in the case of an air ship it would probably be better to have a turtle in the ship flying it and that turtle storing its location in a file inside the turtle. Turtles return true if they have moved and false if they haven't this can be harnessed to make a turtle fly blind with out GPS cluster set up if you tell it its starting location. I would have one GPS cluster just as a point of reference if something goes wrong you will know where you are because of the cluster. as for making the ship go places if there is no obstacle then a simple move on Z then move on Y then Move on Z program should do it. If you want to avoid obstacle then a more complex program would be needed but I'm guessing you want to stay hight above the ground.

To summarize:
A turtle flying the ship storing its location and changing that every time it moves. the smart move API might be of assistance I haven't worked with it but it should have a tracking system for turtle movement. It would get its starting location from the GPS cluster but from then on would not require to be in range This would allow you to fly any ware you want and not worry about range to clusters.
Lyqyd #23
Posted 20 November 2012 - 02:58 PM
For the purposes of a tutorial, it would be better to use Minecraft's (significantly more sensible) coordinate system and axis assignments. Preventing confusing amongst the readers is more important in a tutorial setting than promulgating your own opinions on which axis should be what.
Tiin57 #24
Posted 20 November 2012 - 04:18 PM
You do realize that the picture is completely backwards, right?
BigSHinyToys #25
Posted 21 November 2012 - 12:50 AM
For the purposes of a tutorial, it would be better to use Minecraft's (significantly more sensible) coordinate system and axis assignments. Preventing confusing amongst the readers is more important in a tutorial setting than promulgating your own opinions on which axis should be what.
I can only respond to this by saying dan200 doesn't like people using the real coordinates. and using a debugging too s as a gps is a cheat / hack. that said if you pay the game and ignore that tool with will likely be removed at some point then using the real world system on coordinates would make more sense. If would would like to remove this tutorial and replace it will one you conciser correct I would ask you consult with dan200 or Cloudy first before doing so.


You do realize that the picture is completely backwards, right?
what is backwards ??
leftyisgod #26
Posted 13 December 2012 - 03:29 PM
I have a redpower mobile quarry with an attatched computer and modem. I also have a gps tower set up. I would like to make the computer send a pulse to a specified bundled cable color (diff color wire to a diff frequency to each motor moving the quarry) could someone give me an example on the ways/ codes to do this? i have done simple programs but not anything this big. Thank you for any help
AngelMalus #27
Posted 29 December 2012 - 04:45 PM
I have done this on my AirShip. At first I used a RedPower computer, because they don't loose their texture when moved by frames, but then I upgraded to tekkit 3.1.3 and I can move ComputerCraft computers on the ship.
My computer controls several transmiters that control the engine of the ship. 6 for the 6 axis movement.
It uses a bundleded cable output to acheive this.
As for the GPS system, I must warn you, it can go out of range pretty quick, so you will need to scatter GPS towers around where you want to travel.
Also make sure to have a world anchor on your ship so it will not have problems on unloaded chunks.
(horrible things can happen to your ship if you don't have that, I found my ship slashed in 2 and separated by 8 blocks)
I have several ways to control the ship. with multiple remote controls, from docking stations (airports), from on board.

So to answer your questions:

1) Do you think that is possible?
Yes is possible

2) What would be the best way to implement said system?
I used a computer (not a turtle as suggested earlier), using bundled cables, controlling transmitters.
As for the GOTO program. I have a GoToXZ function where I provide the final destination, and it will start looping pulses to the engine until it reaches the destination. A normal computer can read its own location using gps.locate() same as the turtles.

The fun part is to make everything stick into panels.
FalloutBe #28
Posted 30 December 2012 - 02:48 AM
I have a redpower mobile quarry with an attatched computer and modem. I also have a gps tower set up. I would like to make the computer send a pulse to a specified bundled cable color (diff color wire to a diff frequency to each motor moving the quarry) could someone give me an example on the ways/ codes to do this? i have done simple programs but not anything this big. Thank you for any help
It seems I am trying to do exactly the same thing.
I've set up 4 computer modems for the GPS signal. There is a computer on the quarry with also a modem attached.
My code is not yet finished, but I'm able to do 'goto x y z' and then it requests it current position, substracts that from the destination coordinates, and the result of that is how many blocks it needs to move.
So that result, is the count for the for loop.
Here is the (simple, not yet finished) code:

Spoiler

function showInfo()
shell.run('clear')
print("Quarry control center 1.0")
print("-------------------------")
print("Commands:")
print("dig, moveto")
print("------------------------------------")
end

showInfo()

------------------------------------
local cableside = "back"
local up		= colors.yellow
local down	  = colors.red
local left	  = colors.orange
local right	 = colors.pink
local forwards  = colors.black
local backwards = colors.white
local digblocks = colors.blue
------------------------------------

function noOutput()
rs.setBundledOutput(cableside, 0)
end

------------------------------------

function move(direction, amount, bBreak)
amount = amount or 1
bBreak = bBreak or false
for i=1,amount do
  if bBreak == true then
   rs.setBundledOutput(cableside, digblocks)
   sleep(0.1)
  end
  rs.setBundledOutput(cableside, direction)
  sleep(0.1)
  noOutput()
  sleep(1.8)
end
end

------------------------------------

function moveTo(x, y, z)
local xc, yc, zc = gps.locate(3)
local xm = x-xc
local ym = y-yc
local zm = z-zc

if xm > 0 then
  move(backwards, xm)
elseif xm < 0 then
  move(forwards, -xm)
end

if ym > 0 then
  move(up, ym)
elseif ym < 0 then
  move(down, -ym)
end

if zm > 0 then
  move(left, zm)
elseif zm < 0 then
  move(right, -zm)
end
end

------------------------------------

function dig(blocks)
while true do
  move(left, blocks-5, true)
  move(down, 1, true)
  move(right, blocks-5, true)
  move(down, 1, true)
end
end

------------------------------------

while true do
local input = read()

if input == "dig" then
  write("size=")
  local size = read()
  dig(size*6)

elseif input == "moveto" then
  write("x=")
  local tx = read()
  write("y=")
  local ty = read()
  write("z=")
  local tz = read()

  moveTo(tx, ty, tz)
end

showInfo()
end

------------------------------------

shell.run('clear')
Cozzimoto #29
Posted 30 December 2012 - 05:42 AM
just an fyi to the OP the gps prgram does not use Triangulation because Triangulation uses angles to find its distance to whatever you are using. computers cant get the angles from point a to b and Triangulation requires 3 nodes. the GPS program that is in computercraft uses Trilateration which uses 4 nodes and does not require angles at all but uses math to find a position using straight distance from one point to another.

http://en.wikipedia.org/wiki/Trilateration
Hawkertech #30
Posted 01 January 2013 - 09:45 PM
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.
Spoiler

if not turtle then
print("Error Not turtle")
return
end
if turtle.getFuelLevel() < 600 then
print("600 fuel is required")
return
else
print("Please Place 4 computers in slot one")
print("4 modems in slot two")
print("Disk drive in slot three")
print("and boot disk in slot four")
print("press Enter key to continue")
while true do
  local event , key = os.pullEvent("key")
  if key == 28 then break end
end
print("Launching")
end
local set = {}
set[1] = {x = 0,y = 3,z = 255}
set[2] = {x = 3,y = 0,z = 252}
set[3] = {x = 0,y = -3,z = 255}
set[4] = {x = -3,y = 0,z = 252}
while turtle.up() do
end
for a = 1,4 do
for i = 1,2 do
  turtle.forward()
end
turtle.select(1)
turtle.place()
turtle.back()
turtle.select(2)
turtle.place()
turtle.down()
turtle.forward()
turtle.select(3)
turtle.place()
turtle.select(4)
turtle.drop()
-- make disk cusrom
fs.delete("disk/startup")
file = fs.open("disk/startup","w")
file.write([[fs.copy("disk/install","startup")]])
file.close()
file = fs.open("disk/install","w")
file.write([[shell.run("gps","host",]]..set[a]["x"]..","..set[a]["y"]..","..set[a]["z"]..[[)]])
file.close()
-- end make disk custom
turtle.turnLeft()
turtle.forward()
turtle.up()
turtle.turnRight()
turtle.forward()
turtle.turnRight()
peripheral.call("front","turnOn")
turtle.down()
turtle.suck()
turtle.select(3)
turtle.dig()
turtle.up()
peripheral.call("front","reboot")
turtle.turnRight()
for i = 1,3 do
  turtle.forward()
end
turtle.turnLeft()
turtle.forward()
if a == 1 or a == 3 then
  for i = 1,3 do
  turtle.down()
  end
elseif a == 2 or a == 4 then
  for i = 1,3 do
  turtle.up()
  end
end
end
while turtle.down() do
end

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.
I just tested this in my ssp, it isn't rebooting the computers.
BigSHinyToys #31
Posted 02 January 2013 - 12:59 AM
A limit was placed on how fast a computer could reboot its self this is because having a lot of computers constantly rebooting can cause a lot og lag on servers I have adapted the code to cope with this.
http://pastebin.com/gLTwfr8V
geech #32
Posted 03 January 2013 - 07:40 AM
Um, I think I found an error, (feel free to troll me if i'm wrong).

But isn't the Y coordinate the vertical coordinate?
Then this would make Z north to south…
usmc3891 #33
Posted 04 January 2013 - 12:41 PM
I've changed your code a little bit to allow for the minecraft coord system. Because of my very limited coding experience the turtle has to be facing west for the coords to be correct. It will prompt you for the x and z coords first before launching, Tell me what you think :)/>

http://pastebin.com/kiSuDf0Z
bruteman #34
Posted 05 January 2013 - 04:20 PM
I've changed your code a little bit to allow for the minecraft coord system. Because of my very limited coding experience the turtle has to be facing west for the coords to be correct. It will prompt you for the x and z coords first before launching, Tell me what you think :)/>

http://pastebin.com/kiSuDf0Z

just tried this Pastebin I am not sure where its going wrong it starts to launch after fuel filling it up etc it just moved 2 blocks forward and places a computer and then backs up places a modem on the grass and then sits there.

i am in a mystcraft age if this matters or not?

Edit: himm must have been because it was raining i re-ran this a 3rd time in sunshine daytime and it worked.
usmc3891 #35
Posted 05 January 2013 - 05:50 PM
I found that the only time it did that to me is when i was standing on top of the turtle. I tried to ride it up lol.
Someguy123 #36
Posted 06 January 2013 - 02:20 AM
I had some issues with this set up with one of my turtles, it kept complaining of an ambiguous position, I fixed it simply by placing another computer on a nearby hill and had that run a GPS server too.
Great guide though, it's very easy to follow and I got my GPS system up and running quickly.
PixelToast #37
Posted 06 January 2013 - 08:04 PM
most of the time the abuguous position contains a decimal point wich you can simply filter out giving you one definate position
ill post a suggestion to fix it later
DrCeph #38
Posted 07 January 2013 - 08:13 PM
BSH, thanks for this tutorial mate, really helped clear things up for me!

One observation with the GPS program, I think there may be an offset error with z (vertical):

I launched the turtle from a level where my feet position (y) shows as level 64. However once I've seeded the gps and place a computer/turtle at the same place I launched from, I get a z-coord of 65. If I go down to the lowest bedrock level (i.e only one bedrock block between me and void) feet loc shows as 1 whereas GPS z shows as 2.

Either this is an offset error, or the feet pos in the minecraft debug gives the coord of the block below the feet.
BigSHinyToys #39
Posted 07 January 2013 - 10:35 PM
BSH, thanks for this tutorial mate, really helped clear things up for me!

One observation with the GPS program, I think there may be an offset error with z (vertical):

I launched the turtle from a level where my feet position (y) shows as level 64. However once I've seeded the gps and place a computer/turtle at the same place I launched from, I get a z-coord of 65. If I go down to the lowest bedrock level (i.e only one bedrock block between me and void) feet loc shows as 1 whereas GPS z shows as 2.

Either this is an offset error, or the feet pos in the minecraft debug gives the coord of the block below the feet.
looks like turtles can go to the highs block location or the lowest for some reason correction made to code thanks for pointing that out.

GPS Builder ALPHA v0.2 http://pastebin.com/gLTwfr8V
Niederlenz #40
Posted 07 February 2013 - 11:50 PM
How do I get the coords of my turtle like this?
BigSHinyToys #41
Posted 08 February 2013 - 12:08 AM
How do I get the coords of my turtle like this?

There is a program that CC comes with called "gps" to Quote the help file from it
gps can be used to host a GPS server over rednet, or determine a position using trilateration.
Type "help gpsapi" for help using GPS functions in lua programs.

ex:
"gps locate" will connect to nearby GPS servers, and try to determine the position of the computer or turtle.
"gps host" will try to detemine the position, and host a GPS server if successful.
"gps host 10 20 30" will host a GPS server, using the manually entered position 10,20,30.

Take care when manually entering host positions. If the positions entered into multiple GPS host
are not consisent, the results of locate calls will be incorrect.

if you want to get that information from inside a program you can use the gps api to quote the help files.
Functions in the GPS API:
gps.locate( timeout )

The locate function will send a signal to nearby gps servers, and wait for responses before the timeout. If it receives enough responses to determine this computers position then x, y and z co-ordinates will be returned, otherwise it will return nil. If GPS hosts do not have their positions configured correctly, results will be inaccurate.
MrFrostmaul #42
Posted 23 February 2013 - 01:47 AM
Very helpful and easy guide to understand
WAKU #43
Posted 12 March 2013 - 04:26 AM
excellent!
That's what i need!
Simtimzero #44
Posted 21 March 2013 - 09:37 PM
Woot, thanks a lot for this tutorial. Never used the GPS feature before and its proving to be a huge help in my train station project =D.
PixelToast #45
Posted 22 March 2013 - 02:40 AM
o.o train station?
a gps powered train station would be epic
theoriginalbit #46
Posted 22 March 2013 - 02:41 AM
how would that even work?! o.O
PixelToast #47
Posted 22 March 2013 - 03:06 AM
turtles find position, turtles send data to main host, turtles log whenever someone passes
slango20 #48
Posted 31 March 2013 - 11:32 AM
what was the picture before you fixed it?
aaa #49
Posted 11 July 2013 - 07:47 PM
The position is computed with the distance to the computers. Take 3 of them, and draw the plane that contain them. If you try to locate a turtle which is in a certain position, then the symmetric point at the other side of the plane have the same distances to the computers. that's why we need 4 of them, not in a plane.
RoD #50
Posted 22 July 2013 - 12:19 PM
you have a typo at line 62 it says "mineing" i think you mean "mining" :P/>
Anavrins #51
Posted 25 November 2013 - 05:47 PM
Might be a good idea to mention to always use coordinates that are between parentheses, because the ones with decimals will error by one when there's negative coordinates.
buzzy613 #52
Posted 10 December 2013 - 01:21 AM
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).
You could set up a monitor that shows the positions of all your turtles on a map of sorts.
would look awesome!