Difference between revisions of "Gps (API)"
(Added a sentence clarifying how the hosts should be set up in order to get unambiguous coordinates.) |
|||
Line 1: | Line 1: | ||
The gps API provides a method for turtles and computers to retrieve their own locations. | The gps API provides a method for turtles and computers to retrieve their own locations. | ||
− | It broadcasts a PING message over [[Rednet_(API)|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 [https://en.wikipedia.org/wiki/Trilateration trilateration]. You can set up hosts using the [[Gps (program)|gps program]]. | + | It broadcasts a PING message over [[Rednet_(API)|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 [https://en.wikipedia.org/wiki/Trilateration trilateration]. Three of these hosts should be in a plane, and the fourth should be either above or below the other three. You can set up hosts using the [[Gps (program)|gps program]]. |
Note: When entering in the coordinates for the ''host'' you need to put in the x,y,z of the computer, not the modem, as all rednet distances are measured from the block the computer is in. <!-- do not edit this without actually testing it yourself --> | Note: When entering in the coordinates for the ''host'' you need to put in the x,y,z of the computer, not the modem, as all rednet distances are measured from the block the computer is in. <!-- do not edit this without actually testing it yourself --> |
Revision as of 19:09, 18 September 2012
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. Three of these hosts should be in a plane, and the fourth should be either above or below the other three. 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 computer, not the modem, as all rednet distances are measured from the block the computer is in.
Methods
Method name | Description |
---|---|
gps.locate(timeout, debug) | Tries to retrieve the computer or turtles own location. @param timeout the amount of time, in seconds, to wait for a rednet response |