Τοποθεσία#

Εισαγωγή#

Ο αισθητήρας τοποθεσίας VEX VR μπορεί να παρακολουθεί την τοποθεσία και τη γωνία του ρομπότ μέσα σε διαφορετικές παιδικές χαρές.

Παρακάτω είναι μια λίστα με όλες τις διαθέσιμες μεθόδους:

position#

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

Usage:
location.position(axis, units)

Παράμετροι

Περιγραφή

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)

Παράμετροι

Περιγραφή

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)