Jump to content




Why does gps.locate() fail occasionally?


5 replies to this topic

#1 luochen1990

  • Members
  • 27 posts

Posted 12 February 2020 - 04:52 AM

From [this post](http://www.computerc...et-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?

#2 Lupus590

  • Members
  • 1,995 posts
  • LocationUK

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.computerc...osition-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

#3 luochen1990

  • Members
  • 27 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).

#4 Lupus590

  • Members
  • 1,995 posts
  • LocationUK

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?

#5 luochen1990

  • Members
  • 27 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

#6 Lupus590

  • Members
  • 1,995 posts
  • LocationUK

Posted 13 February 2020 - 08:32 AM

Can you add a print(GPS.locate(nil, true)) near everywhere you do GPS.locate() please





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users