Transmisión#

Funciones#

drivetrain.drive()#

Este es un comando sin espera y permite que cualquier comando posterior se ejecute sin demora.

The drivetrain.drive(direction) command is used to move the Drivetrain in the specified direction forever, until a new drivetrain command is used, or the project is stopped.

Parámetros

Descripción

dirección

The direction for the Drivetrain to move in: FORWARD or REVERSE.

Devoluciones: Ninguna.

def main():
    # Drive forward.
    drivetrain.drive(FORWARD)
    # Wait 2 seconds. 
    wait(2, SECONDS)
    # Stop the Drivetrain.
    drivetrain.stop()

drivetrain.drive_for()#

The drivetrain.drive_for(direction, distance, units, wait) command is used to move the Drivetrain for a given distance.

This is can be a non-waiting or waiting command depending on if the wait parameter is used.

Parámetros

Descripción

dirección

The direction for the Drivetrain to move in: FORWARD or REVERSE.

distancia

El valor para que el tren motriz se mueva.

unidades

The units that the distance will use: MM (Millimeters) or INCHES.

esperar

Optional. The wait parameter determines whether the command will block subsequent commands (wait=True) or allow immediate execution (wait=False). If unspecified, the default for the wait parameter is wait=True.

Devoluciones: Ninguna.

def main():
    # Move the Drivetrain forward for 500 MM.
    drivetrain.drive_for(FORWARD, 500, MM)

drivetrain.drive_to()#

The drivetrain.drive_to(object, wait) command is used to drive the VR Rover the distance between it and a specified object.

This is can be a non-waiting or waiting command depending on if the wait parameter is used.

Parámetros

Descripción

objeto

The object that the VR Rover will drive to: BASE, ENEMY, or MINERALS.

esperar

Optional. The wait parameter determines whether the command will block subsequent commands (wait=True) or allow immediate execution (wait=False). If unspecified, the default for the wait parameter is wait=True.

If a mineral or enemy is not detected in the VR Rover’s visual range when the drivetrain.drive_to() command is called, the robot will not drive.

However, when the BASE parameter is used, the robot will drive forward the amount of distance between it and the base.

Devoluciones: Ninguna.

def main():
    # Drive the VR Rover to the nearest mineral.
    drivetrain.drive_to(MINERALS)

drivetrain.go_to()#

The drivetrain.go_to(object, wait) command is used to turn and drive the VR Rover to a specified object.

This is can be a non-waiting or waiting command depending on if the wait parameter is used.

Parámetros

Descripción

objeto

The object that the VR Rover will turn and drive to: BASE, ENEMY, or MINERALS.

esperar

Optional. The wait parameter determines whether the command will block subsequent commands (wait=True) or allow immediate execution (wait=False). If unspecified, the default for the wait parameter is wait=True.

If a mineral or enemy is not detected in the VR Rover’s visual range when the drivetrain.go_to() command is called, the robot will not drive.

However, when the BASE parameter is used, the robot will always turn towards the base and then drive towards it.

Devoluciones: Ninguna.

def main():
    # Turn the VR Rover towards the base and drive to it.
    drivetrain.go_to(BASE)

drivetrain.turn()#

The drivetrain.turn(direction) command is used to turn the Drivetrain right or left forever, until a new drivetrain command is used, or the project is stopped.

Este es un comando sin espera y permite que cualquier comando posterior se ejecute sin demora.

Parámetros

Descripción

dirección

The direction for the Drivetrain to turn to: RIGHT or LEFT.

Devoluciones: Ninguna.

def main():
    # Turn right.
    drivetrain.turn(RIGHT)
    # Wait 2 seconds.
    wait(2, SECONDS)
    #  Stop the Drivetrain.
    drivetrain.stop()

drivetrain.turn_for()#

The drivetrain.turn_for(direction, angle, units, wait) turns the drivetrain left or right for a specified angle or rotations.

This is can be a non-waiting or waiting command depending on if the wait parameter is used.

Parámetros

Descripción

dirección

The direction for the Drivetrain to turn towards: LEFT or RIGHT.

ángulo

El ángulo en el que debe girar el tren motriz.

unidades

The unit for the Drivetrain, DEGREES.

esperar

Optional. The wait parameter determines whether the command will block subsequent commands (wait=True) or allow immediate execution (wait=False). If unspecified, the default for the wait parameter is wait=True.

Devoluciones: Ninguna.

def main():
    # Turn the drivetrain to the right for 90 degrees.
    drivetrain.turn_for(RIGHT, 90, DEGREES)

drivetrain.turn_to()#

The drivetrain.turn_to(object, wait) command is used to turn the VR Rover towards a specified object.

This is can be a non-waiting or waiting command depending on if the wait parameter is used.

Parámetros

Descripción

objeto

The object that the VR Rover will turn to: BASE, ENEMY, or MINERALS.

esperar

Optional. The wait parameter determines whether the command will block subsequent commands (wait=True) or allow immediate execution (wait=False). If unspecified, the default for the wait parameter is wait=True.

If a mineral or enemy is not detected in the VR Rover’s visual range when the drivetrain.drive_to() command is called, the robot will not drive.

However, when the BASE parameter is used, the robot will turn to face the base.

Devoluciones: Ninguna.

def main():
    # Turn the VR Rover towards the nearest mineral.
    drivetrain.turn_to(MINERALS)

drivetrain.turn_to_heading()#

The drivetrain.turn_to_heading(angle, units, wait) command is used to turn a Drivetrain to a specific heading(angle) using the built in Gyro sensor.

This is can be a non-waiting or waiting command depending on if the wait parameter is used.

Parámetros

Descripción

ángulo

El rumbo (ángulo) hacia el que debe girar el tren motriz.

unidades

The unit for the Drivetrain, DEGREES.

esperar

Optional. The wait parameter determines whether the command will block subsequent commands (wait=True) or allow immediate execution (wait=False). If unspecified, the default for the wait parameter is wait=True.

Devoluciones: Ninguna.

def main():
    # Turn towards 90 degrees (East).
    drivetrain.turn_to_heading(90, DEGREES)

drivetrain.turn_to_rotation()#

The drivetrain.turn_to_rotation(angle, units, wait) command is used to turn a Drivetrain to a specific angle of rotation using the built in Gyro sensor.

This is can be a non-waiting or waiting command depending on if the wait parameter is used.

Parámetros

Descripción

ángulo

El rumbo (ángulo) hacia el que debe girar el tren motriz.

unidades

The unit for the Drivetrain, DEGREES.

esperar

Optional. The wait parameter determines whether the command will block subsequent commands (wait=True) or allow immediate execution (wait=False). If unspecified, the default for the wait parameter is wait=True.

Devoluciones: Ninguna.

def main():
    # Turn to 180 degrees.
    drivetrain.turn_to_rotation(180, DEGREES)

drivetrain.stop()#

The drivetrain.stop() command is used to stop the Drivetrain.

Este es un comando sin espera y permite que cualquier comando posterior se ejecute sin demora.

Devoluciones: Ninguna.

def main():
    # # Drive the Drivetrain forward.
    drivetrain.drive(FORWARD)
    # Wait 5 seconds.
    wait(5, SECONDS)
    # Stop the drivetrain.
    drivetrain.stop()

drivetrain.set_drive_velocity()#

The drivetrain.set_drive_velocity(velocity,units) command is used to set the velocity of the Drivetrain.

Este es un comando sin espera y permite que cualquier comando posterior se ejecute sin demora.

Parámetros

Descripción

velocidad

La velocidad del tren motriz, de 0 a 100%.

unidades

The unit for the Drivetrain’s velocity, PERCENT.

Devoluciones: Ninguna.

De forma predeterminada, la velocidad del tren motriz se establece al 50 %.

def main():
    # Set the Drivetrain's velocity to 100%.
    drivetrain.set_drive_velocity(100, PERCENT)
    # Drive forward for 200 mm.
    drivetrain.drive_for(FORWARD, 200, MM)

drivetrain.set_turn_velocity()#

The drivetrain.set_turn_velocity(VELOCITY,PERCENT) command is used to set the velocity of the Drivetrain’s turns.

Este es un comando sin espera y permite que cualquier comando posterior se ejecute sin demora.

Parámetros

Descripción

velocidad

La velocidad del tren motriz, de 0 a 100%.

unidades

The unit for the Drivetrain’s turn velocity, PERCENT.

Devoluciones: Ninguna.

De forma predeterminada, la velocidad de giro del tren motriz se establece al 50 %.

def main():
    # Set the Drivetrain's turn velocity to 100%.
    drivetrain.set_turn_velocity(100, PERCENT)
    # Turn 270 degrees to the left.
    drivetrain.turn_for(LEFT, 270, DEGREES)

drivetrain.set_heading()#

The drivetrain.set_heading(angle,units) command is used to sets the Drivetrain’s Gyro heading value.

Este es un comando sin espera y permite que cualquier comando posterior se ejecute sin demora.

Parámetros

Descripción

ángulo

El valor en el que se establecerá el rumbo del giro del tren motriz.

unidades

The unit for the Drivetrain, DEGREES.

Devoluciones: Ninguna.

En este ejemplo, el tren motriz no debería moverse porque el rumbo ya es de 90 grados.

def main():
    # Set the current heading of the VR Robot to 0 degrees.
    drivetrain.set_heading(90, DEGREES)
    # Turn right to 90 degrees. 
    drivetrain.turn_to_heading(90, DEGREES)

drivetrain.set_rotation()#

The drivetrain.set_rotation(angle, units) command is used to sets the Drivetrain’s angle of rotation.

Este es un comando sin espera y permite que cualquier comando posterior se ejecute sin demora.

Parámetros

Descripción

ángulo

El número entero en el que se establecerá el ángulo de rotación del tren motriz.

unidades

The angle of rotation’s unit, DEGREES.

Devoluciones: Ninguna.

def main():
    # Set the Drivetrain's angle of rotation to 600 degrees.
    drivetrain.set_rotation(600, DEGREES)
    # Turn to 0 degrees.
    drivetrain.turn_to_rotation(0, DEGREES)