This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Tclord's profile picture

GPS bug?

Started by Tclord, 15 November 2012 - 03:57 PM
Tclord #1
Posted 15 November 2012 - 04:57 PM
It seems like my gps locate it off by one in the Z coordinate. I have 4 hosts at:

<-111, 255, 15>
<-111, 255, -31>
<-64, 255, -31>
<-64, 240, 15>

I have REI's minimap installed so I know for a fact these are the correct locations of these 4 host computers.

I have a turtle at location <-79, 54, -16> but gps locate says it is at <-79, 54, -17>. Is this a bug or could I be doing something wrong here? I'm wondering if the fact that I have two hosts with a positive Z and two hosts with a negative Z is causing strange roundoff errors or something. Can anyone else test this setup and see if you get the same results? Thanks.
Cranium #2
Posted 15 November 2012 - 06:35 PM
You do know that Rei's minimap goes based off of your head height right? And if you put something at ground level below your head, it will be off by one.
jag #3
Posted 15 November 2012 - 06:56 PM
Something very important that you must know is that the position is relative to the modems position.
So you dont set the computers position, you set the position of the modem.

Another note is that rei's minimap got 2 y coordinates under the map. The first one is your heads position and the second is your feets position.
You can simply see this because the first one is 1 higher.
Tclord #4
Posted 15 November 2012 - 09:58 PM
Head position, feet position, doesn't matter really. So long as you are consistant with what you are using, it will all be the same since it's all relative anyway. it isn't the Y coordinate that is off anyway, it is the Z coordinate.

I put the modems on the bottoms of four host computers, so it should all be alright I would think. For a turtle, I guess the modem position depends on the direction the turtle is facing? That would make it fairly complex for a turtle to figure out it's actual position. How do you go about correcting for modem positioning to get correct turtle coordinates then?

I added a fifth computer at <-111, 140, 15> and now my turtle is detecting it's position even more inaccurately. Until I understand why this is happening it makes utilizing GPS useless for me really. Oh well.
Cloudy #5
Posted 15 November 2012 - 10:20 PM
The position is always the computer or turtle, not the modem location. The gps code is in Lua - if you can find a bug in it please let us know.
jag #6
Posted 16 November 2012 - 04:47 AM
The position is always the computer or turtle, not the modem location. The gps code is in Lua - if you can find a bug in it please let us know.
Ok well then I've got it wrong for a long time :/
dan200 #7
Posted 16 November 2012 - 06:15 AM
Something very important that you must know is that the position is relative to the modems position.
So you dont set the computers position, you set the position of the modem.

Another note is that rei's minimap got 2 y coordinates under the map. The first one is your heads position and the second is your feets position.
You can simply see this because the first one is 1 higher.

This is wrong. It uses the Computers position.
jag #8
Posted 16 November 2012 - 06:54 PM
Something very important that you must know is that the position is relative to the modems position.
So you dont set the computers position, you set the position of the modem.

Another note is that rei's minimap got 2 y coordinates under the map. The first one is your heads position and the second is your feets position.
You can simply see this because the first one is 1 higher.

This is wrong. It uses the Computers position.
yeah, cloudy said that.
Tclord #9
Posted 16 November 2012 - 07:24 PM
I think I may have figured it out. When REI's minimap says -15.52 then I say "ok, at -15" and when it says 15.43 I say "ok, that's 15" but the problem is I should be using the floor of these numbers probably. so -15.52 should be -16 rather than -15. So the positions I was telling the hosts they were at wasn't always right. Hopefully anyone else who ever reads this with similar problems can learn from my mistake.