Location#

Introduction#

The VEX VR Location Sensor can track the robot’s location and angle within the different playgrounds.

Below is a list of all available methods:

position#

position returns the X or Y coordinate position of the VR Robot.

Usage:
location.position(axis, units)

Parameters

Description

axis

The axis to return the position of:

  • X
  • Y

units

The unit to represent the position:

  • INCHES
  • MM – millimeters
def main():
    # Display the Y position after driving
    drivetrain.drive_for(FORWARD, 100, MM)
    brain.print(location.position(Y, MM))

# VR threads — Do not delete
vr_thread(main)

position_angle#

position_angle returns the angle of the robot in degrees.

Usage:
location.position_angle(units)

Parameters

Description

units

The unit to represent the angle:

  • DEGREES
def main():
    # Display the angle after turning
    drivetrain.turn_for(RIGHT, 135, DEGREES)
    brain.print(location.position_angle(DEGREES))

# VR threads — Do not delete
vr_thread(main)