Python específico para robots#

Introducción#

The Hero Bot, Moby, includes a motor group, Optical Sensor, Rotation Sensor, and Game Positioning System (GPS) Sensor.

All standard VEXcode VR methods are available for use in the V5RC 21-22 Tipping Point Playground.

Below is a list of all available Robot-specific methods:

Drivetrain – Move and turn the robot.

  • Comportamiento

    • drive — Moves the robot forward or reverse forever.

    • drive_for — Moves the robot forward or reverse for a specific distance.

    • turn — Turns the robot left or right forever.

    • turn_for — Turns the robot left or right for a specific number of degrees.

    • turn_to_heading — Turns the robot to face a specific heading from -359 to 359 degrees.

    • turn_to_rotation — Turns the robot to a specific rotation.

    • stop — Stops the robot’s movement.

  • Mutadores

  • Obtenidos

    • heading — Returns the robot’s current heading from 0 to 359.99 degrees.

    • rotation — Returns the robot’s current rotation.

    • is_done — Returns whether the robot is finished moving, as a Boolean value.

    • is_moving — Returns whether the robot is moving, as a Boolean value.

    • velocity — Returns how fast the robot is driving.

Motion – Move and track the robot’s motor group.

  • Comportamiento

    • spin — Spins a motor group forward or reverse forever.

    • spin_for — Spins a motor group for a specific distance.

    • spin_to_position — Spins a motor group to a specific position.

    • stop — Stops a motor group from spinning.

  • Mutadores

    • set_position — Changes the motor group’s current position to a new value.

    • set_velocity — Tells a motor group how fast to spin.

    • set_timeout — Sets how much time a motor group will try to finish a movement.

  • Obtenidos

    • is_done — Returns whether the motor group is finished moving, as a Boolean value.

    • is_spinning — Returns whether the motor group is spinning, as a Boolean value.

    • position — Returns the motor group’s current position.

    • velocity — Returns how fast the motor group is spinning.

Detección: Utilice los diversos sensores del robot.

  • Óptico

    • is_near_object – Returns whether the Optical Sensor detects an object within range.

    • color – Returns the color detected by the Optical Sensor.

    • brightness – Returns the amount of light reflected from the object.

    • hue – Returns the hue detected by the Optical Sensor.

    • object_detected – Registers a function to be called when the Optical Sensor detects an object.

    • object_lost – Registers a function to be called when the Optical Sensor loses an object.

  • Rotación

    • set_position – Sets the current position of the Rotation Sensor to a specific value.

    • angle – Returns the current angle of the sensor between 0 and 359.99 degrees.

    • position – Returns the total rotational position in degrees or turns.

  • GPS

    • x_position – Returns the current x coordinate of a GPS Sensor on the field.

    • y_position – Returns the current y coordinate of a GPS Sensor on the field.

    • heading – Returns the heading that the robot is currently facing based on the GPS Sensor’s readings from 0 to 359 degrees.

Los ejemplos de esta página utilizan la posición de inicio predeterminada del Playground.

Drivetrain#

The drivetrain controls how the VR Robot drives and turns. The drivetrain can move forward or reverse, turn left or right, turn to headings, and track its rotation.

Comportamiento#

drive#

drive moves the robot forward or reverse forever. The robot will continue to move until it is given another action, like turning or stopping.

Usage:
drivetrain.drive(direction)

Parámetros

Descripción

direction

The direction the robot moves: FORWARD or REVERSE.

def main():
    # Drive forward then stop
    drivetrain.drive(FORWARD)
    wait(2, SECONDS)
    drivetrain.stop()

# VR threads — Do not delete
vr_thread(main)

drive_for#

drive_for moves the robot forward or reverse for a specific distance. The project will wait until the robot is done moving before the next line of code runs.

Usage:
drivetrain.drive_for(direction, distance, units, wait)

Parámetros

Descripción

direction

The direction the robot moves: FORWARD or REVERSE.

distance

The distance the robot drives. This can be an integer or decimal (float).

units

Optional. The distance unit: INCHES (default) or MM (millimeters).

wait

Optional. wait=True (default) makes the project wait until the robot is done moving before the next line of code runs. wait=False makes the next line of code run right away.

def main():
    # Drive forward and backward
    drivetrain.drive_for(FORWARD, 200, MM)
    drivetrain.drive_for(REVERSE, 200, MM)

# VR threads — Do not delete
vr_thread(main)

turn#

turn turns the robot left or right forever. The robot will continue to turn until it is given another action, like driving or stopping.

Usage:
drivetrain.turn(direction)

Parámetros

Descripción

direction

The direction the robot turns: LEFT or RIGHT.

def main():
    # Turn right and left, then stop
    drivetrain.turn(RIGHT)
    wait(2, SECONDS)
    drivetrain.turn(LEFT)
    wait(2, SECONDS)
    drivetrain.stop()

# VR threads — Do not delete
vr_thread(main)

turn_for#

turn_for turns the robot left or right for a specific number of degrees. The turn is relative to the current position of the robot. The project will wait until the robot is done turning before the next line of code runs.

Usage:
drivetrain.turn_for(direction, angle, units, wait)

Parámetros

Descripción

direction

The direction the robot turns: LEFT or RIGHT.

angle

The number of degrees the robot turns. This can be an integer or decimal (float).

units

Optional. The rotation unit: DEGREES (default).

wait

Optional. wait=True (default) makes the project wait until the robot is done turning before the next line of code runs. wait=False makes the next line of code run right away.

def main():
    # Turn the robot right and left
    drivetrain.turn_for(RIGHT, 90, DEGREES)
    wait(1, SECONDS)
    drivetrain.turn_for(LEFT, 90, DEGREES)

# VR threads — Do not delete
vr_thread(main)

turn_to_heading#

A heading is the direction the robot is facing, measured in degrees. turn_to_heading turns the robot to face a specific heading from -359 to 359 degrees. The robot will turn the shortest direction to reach the target heading.

The robot’s starting heading is 0 degrees.

The project will wait until the robot is done turning before the next line of code runs.

Usage:
drivetrain.turn_to_heading(angle, units, wait)

Parámetros

Descripción

angle

The direction the robot should face, in degrees. This can be an integer or decimal (float) from -359 to 359.

units

Optional. The rotation unit: DEGREES (default).

wait

Optional. wait=True (default) makes the project wait until the robot is done turning before the next line of code runs. wait=False makes the next line of code run right away.

def main():
    # Turn to face the cardinal directions
    drivetrain.turn_to_heading(90, DEGREES)
    wait(1, SECONDS)
    drivetrain.turn_to_heading(180, DEGREES)
    wait(1, SECONDS)
    drivetrain.turn_to_heading(270, DEGREES)
    wait(1, SECONDS)
    drivetrain.turn_to_heading(0, DEGREES)

# VR threads — Do not delete
vr_thread(main)

turn_to_rotation#

turn_to_rotation turns the robot to a specific rotation.

Rotation is how much the robot has turned, measured in degrees. At the beginning of a project, the rotation value is set to 0 degrees. Rotation can also be set using the set_rotation method.

Rotation values are absolute. This means the direction of the turn depends on the robot’s current rotation. Turning right increases the rotation, and turning left decreases the rotation.

For example, if the robot starts at 0 degrees and you turn to a rotation of 720 degrees, it will turn right twice. If you then turn to a rotation of 360 degrees, it will turn left once, because 360 is less than 720.

The project will wait until the robot is done turning before the next line of code runs.

Usage:
drivetrain.turn_to_rotation(angle, units, wait)

Parámetros

Descripción

angle

The rotation value, in degrees, that the robot will turn to. This can be an integer or decimal (float).

units

Optional. The rotation unit: DEGREES (default).

wait

Optional. wait=True (default) makes the project wait until the robot is done turning before the next line of code runs. wait=False makes the next line of code run right away.

def main():
    # Turn left, then spin in a circle
    # clockwise and face right
    drivetrain.turn_to_rotation(-90, DEGREES)
    wait(1, SECONDS)
    drivetrain.turn_to_rotation(450, DEGREES)

# VR threads — Do not delete
vr_thread(main)

detener#

stop stops the robot’s movement.

Usage:
drivetrain.stop()

Parámetros

Descripción

Este método no tiene parámetros.

def main():
    # Drive forward then stop
    drivetrain.drive(FORWARD)
    wait(2, SECONDS)
    drivetrain.stop()

# VR threads — Do not delete
vr_thread(main)

Mutadores#

set_heading#

A heading is the direction the robot is facing, measured in degrees. set_heading changes the robot’s current heading to a new heading value.

For example, if the robot has turned to face right, setting the heading to 0 degrees makes that right-facing position the new 0 degrees. Then the robot can turn to other positions based on that new heading.

Usage:
drivetrain.set_heading(heading, units)

Parámetros

Descripción

heading

The heading value, in degrees, to set for the robot. This can be an integer or decimal (float).

units

Optional. The heading unit: DEGREES (default).

def main():
    # Face the new 0 degrees
    drivetrain.set_heading(90, DEGREES)
    drivetrain.turn_to_heading(0, DEGREES)

# VR threads — Do not delete
vr_thread(main)

set_rotation#

Rotation is how much the robot has turned, measured in degrees. At the beginning of a project, the rotation value is set to 0 degrees. set_rotation changes the robot’s current rotation to a new value.

For example, if the robot has made two full turns to the right, its rotation value will be 720 degrees. Setting the rotation to 0 degrees will reset that rotation from 720 to 0 degrees. Then the robot can turn to rotations based on that new value.

Usage:
drivetrain.set_rotation(rotation, units)

Parámetros

Descripción

rotation

The rotation value, in degrees, to set for the robot. This can be an integer or decimal (float).

units

Optional. The rotation unit: DEGREES (default).

def main():
    # Spin counterclockwise two times
    drivetrain.set_rotation(720, DEGREES)
    drivetrain.turn_to_rotation(0, DEGREES)

# VR threads — Do not delete
vr_thread(main)

establecer_tiempo_de_espera#

set_timeout sets how much time the robot will try to finish a movement. If the robot cannot finish in that time, it will stop trying and move on to the next line of code. This keeps the robot from getting stuck on a movement.

Usage:
drivetrain.set_timeout(value, units)

Parámetros

Descripción

value

The amount of time the robot can try to finish a movement. This can be a positive integer or decimal (float).

units

The time unit: SECONDS or MSEC (milliseconds).

def main():
    # Turn right after driving forward
    drivetrain.set_timeout(1, SECONDS)
    drivetrain.drive_for(FORWARD, 25, INCHES)
    drivetrain.turn_for(RIGHT, 90)

# VR threads — Do not delete
vr_thread(main)

set_drive_velocity#

set_drive_velocity tells the robot how fast to drive. A higher percentage makes the robot drive faster and a lower percentage makes the robot drive slower.

Every project begins with the robot driving at 50% velocity by default.

Note: A higher velocity makes the robot drive faster, but it may be less precise. A lower velocity makes the robot drive slower, but it can be more precise.

Usage:
drivetrain.set_drive_velocity(velocity, units)

Parámetros

Descripción

velocity

The velocity to drive with from 0% to 100%. This can be an integer or decimal (float).

units

Optional. The velocity unit: PERCENT (default).

def main():
    # Drive forward at different velocities
    # Default velocity
    drivetrain.drive_for(FORWARD, 150, MM)
    wait(1, SECONDS)
    # Drive slower
    drivetrain.set_drive_velocity(20, PERCENT)
    drivetrain.drive_for(FORWARD, 150, MM)
    wait(1, SECONDS)
    # Drive faster
    drivetrain.set_drive_velocity(100, PERCENT)
    drivetrain.drive_for(FORWARD, 150, MM)

# VR threads — Do not delete
vr_thread(main)

set_turn_velocity#

set_turn_velocity tells the robot how fast to turn. A higher percentage makes the robot turn faster and a lower percentage makes the robot turn slower.

Every project begins with the robot turning at 50% velocity by default.

Note: A higher velocity makes the robot turn faster, but it may be less precise. A lower velocity makes the robot turn slower, but it can be more precise.

Usage:
drivetrain.set_turn_velocity(velocity, units)

Parámetros

Descripción

velocity

The velocity to turn with from 0% to 100%. This can be an integer or decimal (float).

units

Optional. The velocity unit: PERCENT (default).

def main():
    # Turn at different velocities
    # Default velocity
    drivetrain.turn_for(RIGHT, 120, DEGREES)
    wait(1, SECONDS)
    # Turn slower
    drivetrain.set_turn_velocity(20, PERCENT)
    drivetrain.turn_for(RIGHT, 120, DEGREES)
    wait(1, SECONDS)
    # Turn faster
    drivetrain.set_turn_velocity(100, PERCENT)
    drivetrain.turn_for(RIGHT, 120, DEGREES)

# VR threads — Do not delete
vr_thread(main)

Getters#

título#

A heading is the direction the robot is facing, measured in degrees. heading returns the robot’s current heading from 0 to 359.99 degrees.

The robot’s starting heading is 0 degrees.

Usage:
drivetrain.heading(units)

Parámetros

Descripción

units

Optional. The heading unit: DEGREES (default).

def main():
    # Display the heading after turning
    drivetrain.turn_for(RIGHT, 450, DEGREES)
    brain.screen.print("Heading: ")
    brain.screen.print(drivetrain.heading(DEGREES))

# VR threads — Do not delete
vr_thread(main)

rotation#

Rotation is how much the robot has turned, measured in degrees. At the beginning of a project, the rotation value is set to 0 degrees. rotation returns the robot’s current rotation.

Turning right increases the rotation, and turning left decreases the rotation. For example, making two full turns to the right will return a rotation of 720 degrees.

Usage:
drivetrain.rotation(units)

Parámetros

Descripción

units

Optional. The rotation unit: DEGREES (default).

def main():
    # Display the rotation after turning
    drivetrain.turn_for(RIGHT, 450, DEGREES)
    brain.screen.print("Rotation: ")
    brain.screen.print(drivetrain.rotation(DEGREES))

# VR threads — Do not delete
vr_thread(main)

está_hecho#

is_done returns whether the robot is finished moving, as a Boolean value. This can be used to control the timing of other behaviors based on the robot’s movement.

  • True — The robot is finished moving.

  • False — The robot is still moving.

This method works together with the following Drivetrain methods that have the wait parameter: drive_for, turn_for, turn_to_heading, and turn_to_rotation.

Usage:
drivetrain.is_done()

Parámetros

Descripción

Este método no tiene parámetros.

is_moving#

is_moving returns whether the robot is moving, as a Boolean value. This can be used to control the timing of other behaviors based on the robot’s movement.

  • True — The robot is moving.

  • False — The robot is not moving.

Usage:
drivetrain.is_moving()

Parámetros

Descripción

Este método no tiene parámetros.

velocidad#

velocity returns how fast the robot is driving, as a percentage from -100% to 100%.

Usage:
drivetrain.velocity(units)

Parámetros

Descripción

units

Optional. The velocity unit: PERCENT (default).

Example

def main():
    # Display the velocity after driving
    drivetrain.drive_for(FORWARD, 150, MM)
    brain.screen.print("Velocity: ")
    brain.screen.print(drivetrain.velocity(PERCENT))

Movimiento#

Moby uses the fork motor group to raise and lower the forks so Rings and Mobile Goals can be transported and scored.

The direction descriptions explain how each direction moves the fork motor group on Moby.

Comportamiento#

girar#

spin spins a motor group forward or reverse forever. The motor group will continue to spin until it is given another action, like spinning in a different direction or stopping.

Usage:
fork_motor_group.spin(direction)

Parámetros

Descripción

direction

The direction the motor group spins:

  • FORWARD — Raises the forks.
  • REVERSE — Lowers the forks.

def main():
    # Spin the motor group forward then stop
    fork_motor_group.spin(FORWARD)
    wait(0.5, SECONDS)
    fork_motor_group.stop()

# VR threads — Do not delete
vr_thread(main)

girar_para#

spin_for spins a motor group for a specific distance. The spin is relative to the current position of the motor group. The project will wait until the motor group is done spinning before the next line of code runs.

Usage:
fork_motor_group.spin_for(direction, distance, units, wait)

Parámetros

Descripción

direction

The direction the motor group spins:

  • FORWARD — Raises the forks.
  • REVERSE — Lowers the forks.

distance

The distance the motor group spins. DEGREES use integers. TURNS can use integers or decimals.

units

Optional. The distance unit: DEGREES (default) or TURNS.

wait

Optional.

  • wait=True (default) — Makes the project wait until the motor group is done spinning before the next line of code runs.
  • wait=False — Makes the next line of code run right away.

def main():
    # Spin the motor group forward then stop
    fork_motor_group.spin_for(FORWARD, 1, TURNS)

# VR threads — Do not delete
vr_thread(main)

girar_a_posición#

spin_to_position spins a motor group to a specific position.

A motor group’s position is how far it has spun, measured in DEGREES or TURNS. One turn is equal to 360 degrees. At the beginning of a project, the motor group position is set to 0 degrees. The motor group position can also be set using the set_position method.

Position values are absolute. This means the direction of the spin depends on the motor group’s current position.

For example, if the motor group starts at 0 degrees and spins to a position of 720 degrees, it will spin forward two turns. If it then spins to a position of 360 degrees, it will spin reverse one turn, because 360 is less than 720.

Usage:
fork_motor_group.spin_to_position(angle, units, wait)

Parámetros

Descripción

angle

The position value the motor group will spin to. DEGREES use integers. TURNS can use integers or decimals.

units

Optional. The position unit: DEGREES (default) or TURNS.

wait

Optional.

  • wait=True (default) — Makes the project wait until the motor group is done spinning before the next line of code runs.
  • wait=False — Makes the next line of code run right away.

def main():
    # Spin the motor group forward then stop
    fork_motor_group.spin_to_position(55, DEGREES)

# VR threads — Do not delete
vr_thread(main)

detener#

stop stops a motor group from spinning.

Usage:
fork_motor_group.stop()

Parámetros

Descripción

Este método no tiene parámetros.

def main():
    # Spin the motor group forward then stop
    fork_motor_group.spin(FORWARD)
    wait(0.5, SECONDS)
    fork_motor_group.stop()

# VR threads — Do not delete
vr_thread(main)

Mutadores#

posición_de_establecer#

A motor group’s position is how far it has spun, measured in DEGREES or TURNS. One turn is equal to 360 degrees. set_position changes the motor group’s current position to a new value.

For example, if a motor group has spun to 180 degrees, setting the position to 0 degrees will reset that position from 180 to 0 degrees. Then the motor group can spin to positions based on that new value.

Usage:
fork_motor_group.set_position(position, units)

Parámetros

Descripción

position

The position value to set for the motor group. DEGREES use integers. TURNS can use integers or decimals.

units

Optional. The position unit: DEGREES (default) or TURNS.

def main():
    # Spin the motor group forward then stop
    fork_motor_group.set_position(90, DEGREES)
    fork_motor_group.spin_to_position(0, DEGREES)

# VR threads — Do not delete
vr_thread(main)

establecer_velocidad#

set_velocity tells a motor group how fast to spin. A higher percentage makes the motor group spin faster and a lower percentage makes the motor group spin slower.

Every project begins with each motor group spinning at 50% velocity by default.

Note: A higher velocity makes the motor group spin faster, but it may be less precise. A lower velocity makes the motor group spin slower, but it can be more precise.

Usage:
fork_motor_group.set_velocity(velocity, units)

Parámetros

Descripción

velocity

The velocity to spin with from 0% to 100%. This can be an integer or decimal (float).

units

The velocity unit: PERCENT.

def main():
    # Spin the motor group forward then stop
    fork_motor_group.set_velocity(75, PERCENT)
    fork_motor_group.spin_to_position(180, DEGREES)

# VR threads — Do not delete
vr_thread(main)

establecer_tiempo_de_espera#

set_timeout sets how much time a motor group will try to finish a movement. If the motor group cannot finish in that time, it will stop trying and move on to the next line of code. This keeps the motor group from getting stuck on a movement.

Usage:
fork_motor_group.set_timeout(value, units)

Parámetros

Descripción

value

The amount of time the motor group can try to finish a movement. This can be a positive integer or decimal (float).

units

The time unit: SECONDS or MSEC (milliseconds).

def main():
    # Spin the motor group forward then stop
    fork_motor_group.set_timeout(2, SECONDS)
    fork_motor_group.spin_to_position(270, DEGREES)

# VR threads — Do not delete
vr_thread(main)

Getters#

está_hecho#

is_done returns whether the motor group is finished moving, as a Boolean value. This can be used to control the timing of other behaviors based on the motor group’s movement.

  • True — The motor group is finished moving.

  • False — The motor group is still moving.

This method works together with the following Motion methods that have the wait parameter: spin_for and spin_to_position.

Usage:
fork_motor_group.is_done()

Parámetros

Descripción

Este método no tiene parámetros.

está_girando#

is_spinning returns whether the motor group is spinning, as a Boolean value. This can be used to control the timing of other behaviors based on the motor group’s movement.

  • True — The motor group is spinning.

  • False — The motor group is not spinning.

This method works together with the following Motion methods that have the wait parameter: spin_for and spin_to_position.

Usage:
fork_motor_group.is_spinning()

Parámetros

Descripción

Este método no tiene parámetros.

posición#

A motor group’s position is how far it has spun, measured in DEGREES or TURNS. One turn is equal to 360 degrees. position returns the motor group’s current position.

At the beginning of a project, the motor group position is set to 0 degrees. If the motor group spins one full turn forward, the position will be 360 degrees or 1 turn. If the motor group spins the other direction, the position will be negative.

Usage:
fork_motor_group.position(units)

Parámetros

Descripción

units

The unit to return the motor group position in: DEGREES or TURNS.

velocidad#

velocity returns how fast the motor group is spinning.

A positive value means the motor group is spinning forward. A negative value means the motor group is spinning in reverse.

Usage:
fork_motor_group.velocity(units)

Parámetros

Descripción

units

The velocity unit to return: PERCENT.

Detección#

Óptico#

is_near_object#

is_near_object returns a Boolean indicating whether or not the Optical Sensor detects an object within range.

  • True – The Optical Sensor detects an object.

  • False – The Optical Sensor does not detect an object.

Usage:
optical.is_near_object()

Parámetros

Descripción

Este método no tiene parámetros.

color#

color returns an instance of a Color class, based on the detected hue value. These can be compared to predefined Color objects to create conditional statements.

Possible colors are:

  • NONE

  • RED - A hue value between 340° - 20°

  • GREEN - A hue value between 80° - 140°

  • BLUE - A hue value between 200° - 240°

  • YELLOW - A hue value between 40° - 60°

  • ORANGE - A hue value between 20° - 40°

  • PURPLE - A hue value between 240° - 280°

  • CYAN - A hue value between 140° - 200°

Note: The Optical Sensor is looking for hue ranges that match the specified color. For detecting specific hue ranges, see hue.

Usage:
optical.color()

Parámetros

Descripción

Este método no tiene parámetros.

brillo#

brightness returns the amount of light reflected from the object as a decimal (float) representing a percent.

A higher percentage means more light is reflected back to the Optical Sensor. A lower percentage means less light is reflected back.

Usage:
optical.brightness()

Parámetros

Descripción

Este método no tiene parámetros.

matiz#

hue returns the hue value of the detected color as a decimal (float) from 0 to 359.

Hue is a way to describe color using numbers around a color wheel.

Una rueda de colores circular que muestra un espectro completo de tonalidades etiquetadas con valores de grados alrededor del perímetro, aumentando en incrementos de 30 grados desde 0° en la parte superior hasta 360°.

Usage:
optical.hue()

Parámetros

Descripción

Este método no tiene parámetros.

objeto_detectado#

object_detected registers a function to be called whenever the Optical Sensor detects a new object.

Usage:
optical.object_detected(callback, arg)

Parámetros

Descripción

callback

A previously defined function that executes when the Optical Sensor detects a new object.

arg

Optional. A tuple containing arguments to pass to the callback function. See Using Functions with Parameters for more information.

objeto_perdido#

object_lost registers a function to be called whenever the Optical Sensor loses a detected object.

Usage:
optical.object_lost(callback, arg)

Parámetros

Descripción

callback

A previously defined function that executes when the Optical Sensor loses a detected object.

arg

Optional. A tuple containing arguments to pass to the callback function. See Using Functions with Parameters for more information.

Rotación#

posición_de_establecer#

set_position sets the current position of the Rotation Sensor to a value in degrees.

Usage:
rotation.set_position(position, units)

Parámetros

Descripción

posición

La posición en la que se debe colocar el sensor de rotación.

unidades

Optional. The position unit:DEGREES (default) or TURNS

ángulo#

angle returns the current angle of the sensor as a float.

Usage:
rotation.angle(units)

Parámetros

Descripción

unidades

Optional. The angle unit:

  • DEGREES (default) – 0 to 359.99
  • TURNS

posición#

position returns the total rotational position.

Usage:
rotation.position(units)

Parámetros

Descripción

unidades

Optional. The position unit:

  • DEGREES (default) – 0 to 359 as an integer
  • TURNS – As a float

GPS#

posición_x#

x_position returns the current x coordinate of a GPS (Game Positioning System™) Sensor on the field.

Usage:
gps.x_position(units)

Parámetros

Descripción

unidades

The unit of the offset value: INCHES or MM

posición_y#

y_position returns the current y coordinate of a GPS (Game Positioning System™) Sensor on the field.

Usage:
gps.y_position(units)

Parámetros

Descripción

unidades

The unit of the offset value: INCHES or MM

título#

heading returns the heading that the robot is currently facing based on the GPS (Game Positioning System™) Sensor’s readings from 0 to 359 degrees.

Usage:
gps.heading()

Parámetros

Descripción

Este método no tiene parámetros.