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:
Orientation — Return and set the robot’s orientation.
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.
Motion — Return the acceleration of the robot.
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.
Nota: Si se configura una base de código, un supercoche o un tren motriz, este comando se convierte en 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.
Nota: Si se configura una base de código, un supercoche o un tren motriz, este comando se convierte en 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.
Nota: Si se configura una base de código, un supercoche o un tren motriz, este comando se convierte en 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.
Nota: Si se configura una base de código, un supercoche o un tren motriz, este comando se convierte en 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.
Nota: Si se configura una base de código, un supercoche o un tren motriz, este comando se convierte en drivetrain.get_pitch().
Uso:
inertial.get_pitch()
Parámetros |
Descripción |
|---|---|
Este método no tiene parámetros. |
calibrate#
calibrate calibrates the Inertial Sensor. All subsequent lines of code 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 Brain must remain completely still (i.e., on a stable surface without any external movement). Movement during calibration will produce inaccurate results.
Nota: Si se configura una base de código, un supercoche o un tren motriz, este método no estará disponible.
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.
Nota: Si se configura una base de código, un supercoche o un tren motriz, este método no estará disponible.
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.
Nota: Si se configura una base de código, un supercoche o un tren motriz, este método no estará disponible.
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.
Nota: Si se configura una base de código, un supercoche o un tren motriz, este comando se convierte en 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.
Nota: Si se configura una base de código, un supercoche o un tren motriz, este comando se convierte en 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 |
|---|---|
|
The axis to return the acceleration from:
|
# 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)