Inercial#

Introducción#

El robot VEX 123 cuenta con un sensor inercial incorporado. Este sensor puede medir cómo se mueve el robot.

El sensor inercial utiliza un acelerómetro para medir los cambios en el movimiento, como acelerar, desacelerar o detenerse repentinamente durante un choque.

A continuación se muestra una lista de todos los métodos inerciales:

Obtener: Devuelve cómo se está moviendo el robot.

  • is_crashed — Returns whether the robot has detected a crash.

  • get_acceleration — Returns how quickly the robot is speeding up or slowing down on the selected axis.

Getters#

is_crashed#

is_crashed returns a Boolean that reports whether the robot has detected a crash — a sudden stop or impact.

  • True — The robot has detected a crash.

  • False — The robot has not detected a crash.

Usage:
robot.is_crashed()

Parámetros

Descripción

Este método no tiene parámetros.

# Back up after a crash.
robot.drive(FORWARD)
while not robot.is_crashed():
    wait(0.05, SECONDS)
robot.drive_for(REVERSE, 200, MM)

get_acceleration#

Acceleration is how quickly the robot is speeding up or slowing down. get_acceleration returns the acceleration of the robot on the selected axis, from -4.0 G to 4.0 G.

A G is a unit used to measure acceleration. 1 G is about the acceleration you feel from gravity while sitting still.

The value can be positive or negative depending on the direction of acceleration on the selected axis. The axis options are X, Y, and Z.

Usage:
robot.inertial.get_acceleration(axis)

Parámetros

Descripción

axis

The axis to measure acceleration on: X, Y, or Z.

# Display the acceleration on the X axis
while True:
    console.clear()
    console.print(robot.inertial.get_acceleration(X), precision=2)
    wait(0.1, SECONDS)