In python, I have the following piece of code in Vex VR:
PMX = PMY = 1
def P(v: float): return 24*v
# gps.set_location(PMX * P(-2.5), PMY * P(-1.5), INCHES)
def MoveTo(x, y, reverse=False):
[yDif, xDif] = [P(y*PMY)-gps.y_position(INCHES), P(x*PMX)-gps.x_position(INCHES)]
K1 = math.atan2(yDif, xDif)*180/math.pi
K2 = (math.pi - math.atan2(yDif, abs(xDif)))*180/math.pi
angle = K1 if xDif >= 0 else K2
drivetrain.turn_to_heading(-angle, DEGREES)
drivetrain.drive_for(REVERSE if reverse else FORWARD, math.sqrt(xDif**2 + yDif**2), INCHES)
MoveTo(0,-2,0,0)
# MoveTo(-2.5,-0.5,0,0)
This code allows you to go to any location on the V5 High Stakes Field by tile-coordinates (1 tile coord per 24 inches), where (0,0) is the center of the field.
The line MoveTo(0,-2,0,0)
allows you to go to the spot directly beneath the ladder (you can run the code yourself and see)
However, if you uncomment the last line,
MoveTo(-2.5,-0.5,0,0)
It will go directly to (-2.5,-0.5) instead of (0,-2), then (-2.5,-0.5).
Can you please help me fix this issue?
Thanks.