31 posts
Posted 12 February 2020 - 04:52 AM
From [this post](
http://www.computercraft.info/forums2/index.php?/topic/29887-will-rednet-lost-packet/) I know that the rednet doesn't simulate packet lose and network delay, And since gps is based on rednet, why does gps.locate() fail occasionally?
Considering that I have confirmed that I'm near the gps host servers, what is the exact situation in which gps.locate() will fail occasionally? And how can I avoid them and make sure gps.locate() always success?
2427 posts
Location
UK
Posted 12 February 2020 - 08:50 AM
The best setup has the host servers out of plane with each other. Here's a tutorial with a good screenshot
http://www.computercraft.info/forums2/index.php?/topic/3088-how-to-guide-gps-global-position-system/Also, make sure that your coordinates on your hosts are the positions of the block with the modem on it (the computer) and not the modem itself
31 posts
Posted 12 February 2020 - 09:12 AM
@Lupus590 Thanks for your reply. My GPS host servers works well, and most of the time gps.locate() can success, but it also fails occasionally, So I'm asking about the reason why it fails occasionally, since rednet doesn't simulate packet lose and network delay, I think the result should be certain (always success or always fail at a specific position).
2427 posts
Location
UK
Posted 12 February 2020 - 10:45 AM
What is the return value of GPS.locate or the output of the GPS program when it fails?
31 posts
Posted 13 February 2020 - 03:29 AM
local x, y, z = gps.locate()
when success, x, y and z are numbers, when fail, they are nil
2427 posts
Location
UK
Posted 13 February 2020 - 08:32 AM
Can you add a print(GPS.locate(nil, true)) near everywhere you do GPS.locate() please