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– Returns the robot’s X or Y coordinate.position_angle– Returns the robot’s angle.
position#
position returns the X or Y coordinate position of the VR Robot.
Usage:
location.position(axis, units)
Parameters |
Description |
|---|---|
|
The axis to return the position of:
|
|
The unit to represent the position:
|
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 |
|---|---|
|
The unit to represent the angle:
|
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)