Giroscopio#
Introducción#
El sensor giroscópico mide el rumbo y la rotación del robot.
La categoría Sensor giroscópico solo aparecerá cuando el sensor esté configurado de forma independiente, no como parte de una configuración de transmisión, en la ventana Dispositivos.
This page uses gyro_sensor as the example Gyro Sensor name. Replace it with your own configured name as needed.
A continuación se muestra una lista de los métodos disponibles:
calibrate– Calibrates the configured Gyro Sensor.set_heading– Sets the Gyro Sensor’s current heading to a specified value.set_rotation– Sets the Gyro Sensor’s current cumulative rotation value.heading– Returns the Gyro Sensor’s heading angle as a float.rotation– Returns how much the Gyro Sensor has rotated since the project started as a float.
Constructor – Inicializa manualmente un sensor giroscópico.
Gyro– Create a Gyro Sensor.
calibrar#
calibrate calibrates the Gyro Sensor. All subsequent methods will wait for the calibration to complete before executing. Calibration is an internal procedure that measures and compensates for sensor noise and drift over a specified period. During this time, the sensor must remain completely still (i.e., on a stable surface without any external movement). Movement during calibration will produce inaccurate results.
Usage:
gyro_sensor.calibrate()
Parámetros |
Descripción |
|---|---|
Este método no tiene parámetros. |
establecer_encabezado#
set_heading sets the Gyro Sensor’s current heading to a specified value.
Usage:
gyro_sensor.set_heading(value, units)
Parámetros |
Descripción |
|---|---|
valor |
El valor del encabezado a asignar. |
unidades |
Optional. The units to represent the heading:
|
rotación_del_conjunto#
set_rotation sets the Gyro Sensor’s current cumulative rotation value.
Usage:
gyro_sensor.set_rotation(value, units)
Parámetros |
Descripción |
|---|---|
valor |
El valor de rotación acumulativa a asignar. |
unidades |
Optional. The units to represent the rotation:
|
título#
heading returns the Gyro Sensor heading angle as a float from 0 to 359.99 degrees.
Usage:
gyro_sensor.heading(units)
Parámetros |
Descripción |
|---|---|
unidades |
Optional. The units to represent the heading:
|
rotación#
rotation returns how much the Gyro Sensor has rotated since the project started as a float in degrees: positive for clockwise, negative for counterclockwise.
Usage:
gyro_sensor.rotation(units)
Parámetros |
Descripción |
|---|---|
unidades |
Optional. The units to represent the rotation:
|
Constructor#
Constructors are used to manually create Gyro objects, which are necessary for configuring a Gyro Sensor outside of VEXcode.
Gyro#
Gyro creates a Gyro Sensor.
Usage:
Gyro(port)
Parámetro |
Descripción |
|---|---|
|
The 3-Wire Port that the Gyro Sensor is connected to:
|
# Create a Gyro Sensor in Port A
gyro_sensor = Gyro(brain.three_wire_port.a)