gps
Use modems to locate the position of the current turtle or computers.
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. Three of these hosts should be in a plane,
and the fourth should be either above or below the other three. The three in a
plane should not be in a line with each other. 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
,
and z
coordinates of the block that the modem is connected to, not the modem.
All modem distances are measured from the block that the modem is placed on.
Also note that you may choose which axes x, y, or z refers to - so long as your systems have the same definition as any GPS servers that're in range, it works just the same. For example, you might build a GPS cluster according to this tutorial, using z to account for height, or you might use y to account for height in the way that Minecraft's debug screen displays.
See also
Setting up GPS
For more detailed instructions on setting up GPS
Changes
- New in version 1.31
CHANNEL_GPS = 65534 | The channel which GPS requests and responses are broadcast on. |
---|---|
locate([timeout=2 [, debug=false]]) | Tries to retrieve the computer or turtles own location. |
- CHANNEL_GPS = 65534Source
The channel which GPS requests and responses are broadcast on.
- locate([timeout=2 [, debug=false]])Source
Tries to retrieve the computer or turtles own location.
Parameters
- timeout?
number
=2
The maximum time in seconds taken to establish our position. - debug?
boolean
=false
Print debugging messages
Returns
number
This computer'sx
position.number
This computer'sy
position.number
This computer'sz
position.
Or
- nil If the position could not be established.
- timeout?