GPS Sensor Distance

Hello, i am trying to be able to find the distance between our bot and one of the high goals with the GPS sensor, currently my method includes using the distance formula, sqrt((x2-x1)^2 + (y2-y1)^2), where x2 and y2 is the position of the high goals, (red goal being both positive 1350 and blue goal being both negative 1350 for x and y), and x1 and y1 being the position retrieved from the GPS Sensor.

I get a distance, but i am not sure what that distance means or if its correct, i assumed it was in mm but when i converted it to inches, the distance was still incorrect. Is there something I am doing wrong?

According to the VEX knowledge base the GPS coordinates are in mm ranging from -1.8 meters (-1800 mm) to +1.8 meters (+1800 mm). So it seems your distance is correct. The distance you get from the distance formula is the straight like from the place on your robot you measured from to the place on the high goal that you measure from. If you don’t know what the distance formula is, it is taken from the Pythagorean theorem. Draw a triangle with the bases/legs being 1350 mm each and that outputted distance you get from the distance formula will be the hypotenuse.

1 Like