Inercial#
Introducción#
The Brain has a built-in Inertial Sensor. This sensor can measure how the Brain is moving or turning.
The Inertial Sensor uses two parts to do this. The gyro measures turning, such as which direction the Brain is facing and how far it has turned. The accelerometer measures changes in motion, such as speeding up, slowing down, or stopping suddenly during a crash.
The Inertial blocks can be used to track turns, reset heading or rotation values, detect crashes, and report acceleration.
There are many ways to code the Inertial Sensor. Below is a list of all Inertial blocks:
Settings — Calibrate or set sensor values.
calibrate gyro — Calibrates the Brain’s built-in Inertial Sensor.
set heading — Sets the Brain’s current heading to a new heading value.
set rotation — Sets the Brain’s current rotation to a new rotation value.
Values — Check sensor information.
heading — Reports the Brain’s current heading from 0 to 359 degrees.
rotation — Reports the Brain’s current rotation.
detected crash — Reports whether the Brain has detected a sudden impact.
acceleration — Reports how quickly the Brain is speeding up or slowing down on the selected axis.
calibrar el giroscopio#
The calibrate gyro stack block calibrates the gyro part of the Brain’s built-in Inertial Sensor.
Calibration helps the Inertial Sensor measure turns correctly. Keep the Brain still for about 2 seconds during calibration. If the Brain moves during calibration, heading and rotation values may not measure turns correctly.
The project will wait until calibration is done before the next block in the stack runs.
calibrar el giroscopio
Parámetros |
Descripción |
|---|---|
Este bloque no tiene parámetros. |
establecer rumbo#
A heading is the direction the Brain is facing, measured in degrees from 0 to 359. The set heading stack block changes the Brain’s current heading to a new heading value.
For example, if the Brain has turned to face right, setting the heading to 0 degrees makes that right-facing position the new 0 degrees. Then the Brain can track other headings based on that new direction.
establecer rumbo a [0] grados
Parámetros |
Descripción |
|---|---|
título |
The heading value, in degrees, to set for the Brain. This can be a whole number from 0 to 359. |
rotación del conjunto#
Rotation is how much the Brain has turned, measured in degrees. Unlike heading, rotation can increase past 359 degrees or decrease below 0 degrees. At the beginning of a project, the rotation value is set to 0 degrees. The set rotation stack block changes the Brain’s current rotation to a new value.
For example, if the Brain has made two full turns to the right, its rotation value will be 720 degrees. Setting the rotation to 0 degrees will reset that rotation from 720 to 0 degrees. Then the Brain can track rotations based on that new value.
establecer la rotación a [0] grados
Parámetros |
Descripción |
|---|---|
rotación |
The rotation value, in degrees, to set for the Brain. This can be an integer. |
título#
A heading is the direction the Brain is facing, measured in degrees. The heading reporter block reports that heading from 0 to 359 degrees.
The starting heading is 0 degrees. If the Brain turns past 359 degrees, the heading wraps back to 0 degrees.
(rumbo en grados)
Parámetros |
Descripción |
|---|---|
Este bloque no tiene parámetros. |
rotación#
Rotation is how much the Brain has turned, measured in degrees. At the beginning of a project, the rotation value is set to 0 degrees. The rotation reporter block reports the Brain’s current rotation.
Turning right increases the rotation, and turning left decreases the rotation. For example, making two full turns to the right will report a rotation of 720 degrees. Turning one full turn to the left from 0 degrees will report a rotation of -360 degrees.
(rotación en grados)
Parámetros |
Descripción |
|---|---|
Este bloque no tiene parámetros. |
detected crash#
The detected crash Boolean block reports whether the Brain has detected a sudden impact, such as the robot hitting an object or being bumped hard enough to quickly change its motion.
True — A crash has been detected.
False — A crash has not been detected.
<¿Se detectó un accidente?>
Parámetros |
Descripción |
|---|---|
Este bloque no tiene parámetros. |
Ejemplo
cuando empezó :: hat events
[Build Used: Super Code Base 2.0]
[Back up and turn after crashing.]
set drive velocity to [100] %
unidad [adelante v]
esperar hasta <¿Se detectó un accidente?>
unidad [atrás v] para [100] [mm v] ▶
girar [derecha v] por [90] grado ▶
aceleración#
Acceleration is how quickly the Brain is speeding up or slowing down. The acceleration reporter block reports the acceleration of the Brain 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 selected axis tells which direction of motion the block reports.
(aceleración del eje [incógnita v] en g)
Parámetros |
Descripción |
|---|---|
eje |
The axis to measure acceleration on:
|
Ejemplo
cuando empezó :: hat events
[Build Used: Super Code Base 2.0]
[Display the acceleration after moving.]
establecer la precisión de impresión a [All Digits v]
set drive velocity to [100] %
imprimir [Resting: ] ▶
imprimir (aceleración del eje [incógnita v] en g) ▶
colocar el cursor en la siguiente fila
esperar [1] segundos
unidad [adelante v] para [500] [mm v] ◀ y no esperes
esperar [0.2] segundos
imprimir [Startup: ] ▶
imprimir (aceleración del eje [incógnita v] en g) ▶