Inercial#
Introducción#
El GO Brain incluye un sensor inercial incorporado, que permite al robot rastrear su orientación, rumbo y aceleración.
A continuación se muestra una lista de todos los métodos:
Orientación
get_heading– Returns the current heading.get_rotation– Returns the current rotation.get_yaw– Returns the current yaw.get_roll– Returns the current roll.get_pitch– Returns the current pitch.calibrate– Calibrates the Inertial Sensor for stable heading tracking.reset_heading– Sets the heading of the Inertial Sensor to 0.reset_rotation– Sets the rotation of the Inertial Sensor to 0.set_heading– Sets the Inertial Sensor’s heading to a specified value.set_rotation– Sets the Inertial Sensor’s rotation to a specified value.
Movimiento
get_acceleration– Returns the linear acceleration along the x, y, or z axis.
Orientación#
get_heading#
get_heading devuelve el rumbo actual del sensor inercial en grados.
Note: If a Code Base, Super Car, or Drivetrain is configured, this command becomes drivetrain.get_heading().
Uso:
inertial.get_heading()
Parámetros |
Descripción |
|---|---|
Este método no tiene parámetros. |
get_rotation#
get_rotation devuelve la rotación actual del sensor inercial en grados.
Note: If a Code Base, Super Car, or Drivetrain is configured, this command becomes drivetrain.get_rotation().
Uso:
inertial.get_rotation()
Parámetros |
Descripción |
|---|---|
Este método no tiene parámetros. |
get_yaw#
get_yaw devuelve la guiñada actual del sensor inercial en grados.
Note: If a Code Base, Super Car, or Drivetrain is configured, this command becomes drivetrain.get_yaw().
Uso:
inertial.get_yaw()
Parámetros |
Descripción |
|---|---|
Este método no tiene parámetros. |
get_roll#
get_roll devuelve el giro actual del sensor inercial en grados.
Note: If a Code Base, Super Car, or Drivetrain is configured, this command becomes drivetrain.get_roll().
Uso:
inertial.get_roll()
Parámetros |
Descripción |
|---|---|
Este método no tiene parámetros. |
get_pitch#
get_pitch devuelve el paso actual del sensor inercial en grados.
Note: If a Code Base, Super Car, or Drivetrain is configured, this command becomes drivetrain.get_pitch().
Uso:
inertial.get_pitch()
Parámetros |
Descripción |
|---|---|
Este método no tiene parámetros. |
calibrate#
calibrate calibra el sensor inercial. Todas las líneas subsiguientes esperarán a que se complete la calibración antes de ejecutarse. La calibración es un procedimiento interno que mide y compensa el ruido y la deriva del sensor durante un período específico. Durante este tiempo, el cerebro debe permanecer completamente inmóvil (es decir, sobre una superficie estable sin ningún movimiento externo). El movimiento durante la calibración producirá resultados inexactos.
Note: If a Code Base, Super Car, or Drivetrain is configured, this method becomes unavailable.
Uso:
inertial.calibrate()
Parámetros |
Descripción |
|---|---|
Este método no tiene parámetros. |
reset_heading#
reset_heading restablece el rumbo del sensor inercial a 0 grados.
Note: If a Code Base, Super Car, or Drivetrain is configured, this method becomes unavailable.
Uso:
inertial.reset_heading()
Parámetros |
Descripción |
|---|---|
Este método no tiene parámetros. |
reset_rotation#
reset_rotation restablece la rotación del sensor inercial a 0 grados.
Note: If a Code Base, Super Car, or Drivetrain is configured, this method becomes unavailable.
Uso:
inertial.reset_rotation()
Parámetros |
Descripción |
|---|---|
Este método no tiene parámetros. |
set_heading#
set_heading establece el rumbo del sensor inercial a un valor especificado.
Note: If a Code Base, Super Car, or Drivetrain is configured, this command becomes drivetrain.set_heading().
Uso:
inertial.set_heading(heading)
Parámetros |
Descripción |
|---|---|
|
El valor del rumbo a establecer en grados. |
set_rotation#
set_rotation establece la rotación del sensor inercial a un valor especificado.
Note: If a Code Base, Super Car, or Drivetrain is configured, this command becomes drivetrain.set_rotation().
Uso:
inertial.set_rotation(rotation)
Parámetros |
Descripción |
|---|---|
|
El valor a utilizar para la nueva rotación en grados. |
Movimiento#
get_acceleration#
get_acceleration devuelve la aceleración del sensor inercial.
Uso:
inertial.get_acceleration(axis)
Parámetros |
Descripción |
|---|---|
|
El eje desde el que se retorna la aceleración:
|
# Build Used: Super Code Base 2.0
def main():
# Display the acceleration after moving
drivetrain.set_drive_velocity(100)
console.print("Resting: ")
console.print(inertial.get_acceleration(X), precision=2)
console.new_line()
wait(1, SECONDS)
drivetrain.drive_for(FORWARD, 500, MM, wait=False)
wait(0.20,SECONDS)
console.print("Startup: ")
console.print(inertial.get_acceleration(X), precision=2)
# Start threads — Do not delete
start_thread(main)