CC: Tweaked

CC: Tweaked

42M Downloads

GPS return nil value at some coordinate

kulapa2000 opened this issue ยท 6 comments

commented

Minecraft Version

1.18.x

Version

1.101.2

Details

2023-07-21_20 56 00

I was using the ender modem to get the gps coordinates, and as the screenshot shows, gps works normally at (1437,8,1148) but it returns nil after it went one step forward, which is at (1437,8,1149)

commented

Thank you for the report! Just a couple of questions:

  • What are the positions of your GPS hosts? Just so I can attempt to reproduce this locally!
  • Could you run gps.locate(2, true) as well, and screenshot the result - this should include some additional debugging information, which will help explain why it cannot find the position.
commented

I was using it on a forge server, but when i log into the server today, gps works normally at that coordinate. But please don't close this issue for now, because this bug has showed up for a several times, I will follow up next time it shows up.

commented

I got a new error coordinate this time.
The gps return a nil value at (1411,70,100)

The host position are as follows:
(1557,69,948)
(1557,69,953)
(1562,69,948)
(1557,73,948)

And when I run the gps.locate(2,true) it says ambiguous position
image

commented

Thank you, that's very helpful!

The problem here is that you're very far away from your GPS array, which causes accuracy to suffer. In this particular case, we can't disambiguate on the y axis between $y = 68$ and $y = 70$. If we compare the distances to the GPS host at $(1557, 73, 948)$, we can see why:

$$ \begin{align} \text{distance}(y = 68) &= \sqrt{146^2 + 5^2 + 848^2} \approx 860.492 \\ \text{distance}(y = 70) &= \sqrt{146^2 + 3^2 + 848^2} \approx 860.483 \\ \end{align} $$

Because the two distances are less than 0.01 away from each other, the GPS library decides that's not accurate enough to guarantee the correct position.

The easiest fix here is just to move the GPS hosts further apart. Just shifting the top computer up a few more blocks should help here!

If you're trying to serve a massive area, I normally put my GPS hosts in the corners of a chunk, with 14 blocks between them. So something like this:

A screenshot of a sandstone superflat Minecraft world, with four computers on it. The chunk borders are visible, and we can see three computers are in three corners of the chunk (on a plane) and one computer is high above the others.

commented

Yeah, that's probably not a bad idea.

commented

Hmm, maybe we should add this as a note on the GPS documentation as a long-range setup. I think we should mention the accuracy issue and its symptoms too.