Bloques específicos para robots#

Introducción#

The Hero Bot, Axel, includes two motor options, an AI Vision Sensor, an Optical Sensor, a Rotation Sensor, and a Game Positioning System (GPS) Sensor.

All standard VEXcode VR Blocks are available for use in the V5RC 24-25 High Stakes Playground.

Below is a list of all available Robot-specific Blocks:

Drivetrain – Move and turn the robot.

  • Comportamiento

    • drive — Moves the robot forward or reverse forever.

    • drive for — Moves the robot forward or reverse for a specific distance.

    • turn — Turns the robot left or right forever.

    • turn for — Turns the robot left or right for a specific number of degrees.

    • turn to heading — Turns the robot to face a specific heading.

    • turn to rotation — Turns the robot to a specific rotation.

    • stop driving — Stops the robot’s movement.

  • Ajustes

  • Valores

Movimiento: Mueve y rastrea los motores del robot.

Visión por IA: Captura y analiza objetos utilizando el sensor de visión por IA.

Detección: Utilice los diversos sensores del robot.

Los ejemplos de esta página utilizan la posición de inicio predeterminada del Playground.

Drivetrain#

The drivetrain controls how the VR Robot drives and turns. The drivetrain can move forward or reverse, turn left or right, turn to headings, and track its rotation.

Comportamiento#

drive#

The drive stack block moves the robot forward or reverse forever. The robot will continue to move until it is given another action, like turning or stopping.

unidad [adelante v]

Parámetros

Descripción

dirección

The direction the robot moves: forward or reverse.

Ejemplo

cuando empezó :: hat events
[Drive forward, then stop.]
unidad [adelante v]
esperar (2) segundos
deja de conducir

drive for#

The drive for stack block moves the robot forward or reverse for a specific distance. The project will wait until the robot is done moving before the next block in the stack runs.

unidad [adelante v] para (200) [mm v] ▶

Parámetros

Descripción

dirección

The direction the robot moves: forward or reverse.

distancia

The distance the robot drives. This can be an integer or a decimal.

unidad

The distance unit: mm (millimeters) or inches

and don’t wait

Select the arrow ( ▶ ) to expand the block to say and don’t wait, so the next block in the stack will run right away.

Ejemplo

cuando empezó :: hat events
[Drive forward.]
unidad [adelante v] para (500) [mm v] ▶

turn#

The turn stack block turns the robot left or right forever. The robot will continue to turn until it is given another action, like driving or stopping.

turno [derecha v]

Parámetros

Descripción

dirección

The direction the robot turns: left or right.

Ejemplo

cuando empezó :: hat events
[Turn right, then stop.]
turno [derecha v]
esperar (2) segundos
deja de conducir

turn for#

The turn for stack block turns the robot left or right for a specific number of degrees. The turn is relative to the current position of the robot. The project will wait until the robot is done turning before the next block in the stack runs.

girar [derecha v] por (90) grado ▶

Parámetros

Descripción

dirección

The direction the robot turns: left or right.

angle

The number of degrees the robot turns. This can be an integer or a decimal.

and don’t wait

Select the arrow ( ▶ ) to expand the block to say and don’t wait, so the next block in the stack will run right away.

Ejemplo

cuando empezó :: hat events
[Turn left, then turn around to the right.]
girar [izquierda v] por (90) grado ▶
girar [derecha v] por (180) grado ▶

turn to heading#

A heading is the direction the robot is facing, measured in degrees. The turn to heading stack block turns the robot to face a specific heading from -359 to 359 degrees. The robot will turn the shortest direction to reach the target heading.

The starting heading is 0 degrees.

The project will wait until the robot is done turning before the next block in the stack runs.

girar hacia el rumbo (90) grados ▶

Parámetros

Descripción

heading

The heading the robot should face, from -359 to 359 degrees.

and don’t wait

Select the arrow ( ▶ ) to expand the block to say and don’t wait, so the next block in the stack will run right away.

Ejemplo

cuando empezó :: hat events
[Turn to face the cardinal directions.]
girar hacia el rumbo (90) grados ▶
esperar (2) segundos
girar hacia el rumbo (180) grados ▶
esperar (2) segundos
girar hacia el rumbo (270) grados ▶
esperar (2) segundos
girar hacia el rumbo (0) grados ▶
esperar (2) segundos

turn to rotation#

The turn to rotation stack block turns the robot to a specific rotation.

Rotation is how much the robot has turned, measured in degrees. At the beginning of a project, the rotation value is set to 0 degrees. Rotation can also be set using the set drive rotation block.

Rotation values are absolute. This means the direction of the turn depends on the robot’s current rotation. Turning right increases the rotation, and turning left decreases the rotation.

For example, if the robot starts at 0 degrees and you turn to a rotation of 720 degrees, it will turn right twice. If you then turn to a rotation of 360 degrees, it will turn left once, because 360 is less than 720.

The project will wait until the robot is done turning before the next block in the stack runs.

girar a rotación (90) grados ▶

Parámetros

Descripción

rotation

The rotation value, in degrees, that the robot will turn to. This can be an integer or a decimal.

and don’t wait

Select the arrow ( ▶ ) to expand the block to say and don’t wait, so the next block in the stack will run right away.

Ejemplo

cuando empezó :: hat events
[Turn left, then spin in a circle clockwise and face right.]
girar a rotación (-90) grados ▶
esperar (2) segundos
girar a rotación (450) grados ▶

stop driving#

The stop driving stack block stops the robot’s movement.

deja de conducir

Parámetros

Descripción

Este bloque no tiene parámetros.

Ejemplo

cuando empezó :: hat events
[Drive forward, then stop.]
unidad [adelante v]
esperar [4] segundos
deja de conducir

Ajustes#

set drive velocity#

The set drive velocity stack block tells the robot how fast to drive. A higher percentage makes the robot drive faster and a lower percentage makes the robot drive slower.

Every project begins with the robot driving at 50% velocity by default.

Note: A higher velocity makes the robot drive faster, but it may be less precise. A lower velocity makes the robot drive slower, but it can be more precise.

Establezca la velocidad de la unidad en (50) [% v]

Parámetros

Descripción

velocidad

The velocity to drive with from 0% to 100%.

unidad

The velocity unit: %

Ejemplo

cuando empezó :: hat events
[Drive forward at the default velocity.]
unidad [adelante v] para (100) [mm v] ▶
esperar (1) segundos
[Move slower.]
Establezca la velocidad de la unidad en (20) [% v]
unidad [adelante v] para (100) [mm v] ▶
esperar (1) segundos
[Move faster.]
Establezca la velocidad de la unidad en (100) [% v]
unidad [adelante v] para (100) [mm v] ▶
esperar (1) segundos

set turn velocity#

The set turn velocity stack block tells the robot how fast to turn. A higher percentage makes the robot turn faster and a lower percentage makes the robot turn slower.

Every project begins with the robot turning at 50% velocity by default.

Note: A higher velocity makes the robot turn faster, but it may be less precise. A lower velocity makes the robot turn slower, but it can be more precise.

establecer la velocidad de giro a (50) [% v]

Parámetros

Descripción

velocidad

The velocity to turn with from 0% to 100%.

unidad

The velocity unit: %

Ejemplo

cuando empezó :: hat events
[Turn at default velocity.]
girar [derecha v] por (100) grado ▶
esperar (1) segundos
[Turn slower.]
establecer la velocidad de giro al (20)%
girar [derecha v] por (100) grado ▶
esperar (1) segundos
[Turn faster.]
establecer la velocidad de giro al (100)%
girar [derecha v] por (100) grado ▶
esperar (1) segundos

set drive heading#

A heading is the direction the robot is facing, measured in degrees. The set drive heading stack block changes the robot’s current heading to a new heading value.

For example, if the robot has turned to face right, setting the heading to 0 degrees makes that right-facing position the new 0 degrees. Then the robot can turn to other positions based on that new heading.

establecer el rumbo de la unidad a (0) grados

Parámetros

Descripción

heading

The heading value, in degrees, to set for the robot.

Ejemplo

cuando empezó :: hat events
[Turn to the left.]
establecer el rumbo de la unidad a (90) grados
girar hacia el rumbo (0) grados ▶

set drive rotation#

Rotation is how much the robot has turned, measured in degrees. At the beginning of a project, the rotation value is set to 0 degrees. The set drive rotation stack block changes the robot’s current rotation to a new value.

For example, if the robot 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 robot can turn to rotations based on that new value.

establecer la rotación de la unidad a (0) grados

Parámetros

Descripción

rotation

The rotation value, in degrees, to set for the robot. This can be an integer or a decimal.

Ejemplo

cuando empezó :: hat events
[Spin counterclockwise two times.]
establecer la rotación de la unidad a (720) grados
girar a rotación (0) grados ▶

set drive timeout#

The set drive timeout stack block sets how many seconds the robot will try to finish a movement. If the robot cannot finish in that time it will stop trying and move on to the next block in the stack. This keeps the robot from getting stuck on a movement.

Establezca el tiempo de espera de la unidad en (1) segundos

Parámetros

Descripción

tiempo

The number of seconds the robot can try to finish a movement. This can be a whole number or a decimal.

Ejemplo

When started, limits drive time to 1 second and then turns 90 degrees.#
cuando empezó :: hat events
[Drive forward for 1 second, then turn.]
Establezca el tiempo de espera de la unidad en (1) segundos
unidad [adelante v] para (25) [pulgadas v] ▶
girar [derecha v] por (90) grado ▶

Valores#

drive is done#

The drive is done Boolean block reports whether the robot is finished moving. This can be used to control the timing of other behaviors based on the robot’s movement.

  • True — The robot is finished moving.

  • False — The robot is still moving.

This block works together with drivetrain blocks that have the and don’t wait parameter.

<¿La unidad está lista?>

Parámetros

Descripción

Este bloque no tiene parámetros.

Ejemplo

cuando empezó :: hat events
[Start spinning when the drive is complete.]
unidad [adelante v] para (200) [mm v] ◀ y no esperes
esperar hasta <¿La unidad está lista?>
girar [derecha v] por (360) grado ▶

drive is moving#

The drive is moving Boolean block reports whether the robot is moving. This can be used to control the timing of other behaviors based on the robot’s movement.

  • True — The robot is moving.

  • False — The robot is not moving.

This block works together with drivetrain blocks that have the and don’t wait parameter.

<¿La unidad se está moviendo?>

Parámetros

Descripción

Este bloque no tiene parámetros.

Ejemplo

cuando empezó :: hat events
[Print that the robot is moving while it is still driving.]
unidad [adelante v] para (200) [mm v] ◀ y no esperes
mientras <¿La unidad se está moviendo?>
imprimir [Still Moving...] ▶
esperar (0.1) segundos
pantalla clara
fin
imprimir [Done!] ▶

drive heading#

A heading is the direction the robot is facing, measured in degrees. The drive heading reporter block reports that heading from 0 to 359.99 degrees.

The robot’s starting heading is 0 degrees.

(rumbo de la unidad en grados)

Parámetros

Descripción

Este bloque no tiene parámetros.

Ejemplo

cuando empezó :: hat events
[Display the heading after turning.]
girar [derecha v] por (450) grado ▶
imprimir (rumbo de la unidad en grados) en la pantalla ◀ y coloque el cursor en la siguiente fila

drive rotation#

Rotation is how much the robot has turned, measured in degrees. At the beginning of a project, the rotation value is set to 0 degrees. The drive rotation reporter block reports the robot’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.

(rotación de la unidad en grados)

Parámetros

Descripción

Este bloque no tiene parámetros.

Ejemplo

cuando empezó :: hat events
[Display the rotation after turning.]
girar [derecha v] por (450) grado ▶
imprimir (rotación de la unidad en grados) en la pantalla ◀ y coloque el cursor en la siguiente fila

drive velocity#

The drive velocity reporter block reports how fast the robot is driving.

(velocidad de accionamiento en [% v])

Parámetros

Descripción

unidad

The velocity unit: %

Ejemplo

cuando empezó :: hat events
[Display the velocity after driving.]
unidad [adelante v] para (200) [mm v] ▶
imprimir (velocidad de accionamiento en [% v]) en la pantalla ◀ y coloque el cursor en la siguiente fila

Movimiento#

Axel uses the arm motor to lift and lower the arm so Rings can be positioned near stakes. The pusher motor moves the pusher down the arm to push Rings off the arm and onto a stake.

Each motor has its own direction options. The direction names describe how that motor moves on Axel.

Comportamiento#

motor de giro#

The spin motor stack block spins a motor in one of two directions forever. The motor will continue to spin until it is given another action, like spinning in a different direction or stopping.

girar [ArmMotor v] [arriba v]

Parámetros

Descripción

motor

The motor to spin: ArmMotor or PusherMotor.

dirección

The direction the motor spins:

  • ArmMotorup or down
  • PusherMotorlower or raise

Ejemplo

cuando empezó
[Lift the Arm before moving to a Mobile Goal.]
girar [ArmMotor v] [arriba v]
esperar (1) segundos
parada [ArmMotor v]

motor de giro para#

The spin motor for stack block spins a motor for a specific distance. The spin is relative to the current position of the motor. The project will wait until the motor is done spinning before the next block in the stack runs.

spin [ArmMotor v] [up v] for (90) [degrees v] ▶

Parámetros

Descripción

motor

The motor to spin: ArmMotor or PusherMotor.

dirección

The direction the motor spins:

  • ArmMotorup or down
  • PusherMotorlower or raise

distancia

The distance the motor spins. Degrees use integers. Turns can use integers or decimals.

unidad

The distance unit: degrees or turns.

and don’t wait

Select the arrow ( ▶ ) to expand the block to say and don’t wait, so the next block in the stack will run right away.

Ejemplo

cuando empezó
[Lift the Arm.]
spin [ArmMotor v] [up v] for [200] [degrees v] ▶

motor de giro para posicionar#

The spin motor to position stack block spins a motor to a specific position.

A motor’s position is how far it has spun, measured in degrees or turns. One turn is equal to 360 degrees. At the beginning of a project, the motor position is set to 0 degrees. The motor position can also be set using the set motor position block.

Position values are absolute. This means the direction of the spin depends on the motor’s current position.

For example, if the motor starts at 0 degrees and spins to a position of 720 degrees, it will spin forward two turns. If it then spins to a position of 360 degrees, it will spin reverse one turn, because 360 is less than 720.

girar [ArmMotor v] a la posición (90) [grados v] ▶

Parámetros

Descripción

motor

The motor to spin: ArmMotor or PusherMotor.

posición

The position value the motor will spin to. Degrees use integers. Turns can use integers or decimals.

unidad

The position unit: degrees or turns.

and don’t wait

Select the arrow ( ▶ ) to expand the block to say and don’t wait, so the next block in the stack will run right away.

Ejemplo

cuando empezó
[Lift the Arm.]
spin [ArmMotor v] to position [350] [degrees v] ▶

motor de parada#

The stop motor stack block stops the selected motor.

parada [ArmMotor v]

Parámetros

Descripción

motor

The motor to stop: ArmMotor or PusherMotor.

Ejemplo

cuando empezó
girar [ArmMotor v] [arriba v]
esperar (1) segundos
parada [ArmMotor v]

Ajustes#

establecer la velocidad del motor#

The set motor velocity stack block tells a motor how fast to spin. A higher percentage makes the motor spin faster and a lower percentage makes the motor spin slower.

Every project begins with each motor spinning at 50% velocity by default.

Note: A higher velocity makes the motor spin faster, but it may be less precise. A lower velocity makes the motor spin slower, but it can be more precise.

set [ArmMotor v] velocity to [50] [% v]

Parámetros

Descripción

motor

The motor to set the velocity of: ArmMotor or PusherMotor.

velocidad

The speed the motor will spin at. Percent uses whole numbers from 0% to 100%.

unidad

The velocity unit: %.

Ejemplo

cuando empezó
set [ArmMotor v] velocity to [100] [% v]
spin [ArmMotor v] [up v] for [200] [degrees v] ▶

establecer tiempo de espera del motor#

The set motor timeout stack block sets how much time a motor will try to finish a movement. If the motor cannot finish in that time, it will stop trying and move on to the next block in the stack. This keeps the motor from getting stuck on a movement.

Establezca el tiempo de espera [ArmMotor v] en [1] segundo

Parámetros

Descripción

motor

The motor to set the timeout of: ArmMotor or PusherMotor.

tiempo

The number of seconds the motor can try to finish a movement. This can be a whole number or decimal.

Ejemplo

cuando empezó
Establezca el tiempo de espera [ArmMotor v] en [1] segundo
spin [ArmMotor v] [up v] for [5] [turns v] ▶

Posición#

posición del motor#

A motor’s position is how far it has spun, measured in degrees or turns. One turn is equal to 360 degrees. The motor position reporter block reports the motor’s current position.

At the beginning of a project, the motor position is set to 0 degrees. If the motor spins one full turn forward, the position will be 360 degrees or 1 turn. If the motor spins the other direction, the position will be negative.

([ArmMotor v] position in [degrees v])

Parámetros

Descripción

motor

The motor to report the position of: ArmMotor or PusherMotor.

unidad

The unit to report the motor position in: degrees or turns.

establecer la posición del motor#

A motor’s position is how far it has spun, measured in degrees or turns. One turn is equal to 360 degrees. The set motor position stack block changes the motor’s current position to a new value.

For example, if a motor has spun to 180 degrees, setting the position to 0 degrees will reset that position from 180 to 0 degrees. Then the motor can spin to positions based on that new value.

Establezca la posición [ArmMotor v] en (0) [grados v]

Parámetros

Descripción

motor

The motor to set the position of: ArmMotor or PusherMotor.

posición

The position value to set for the motor. Degrees use integers. Turns can use integers or decimals.

unidad

The position unit: degrees or turns.

Valores#

El motor está terminado#

The motor is done Boolean block reports whether the motor is finished moving. This can be used to control the timing of other behaviors based on the motor’s movement.

  • True — The motor is finished moving.

  • False — The motor is still moving.

This block works together with the following Motion blocks that have the and don’t wait parameter: spin motor for and spin motor to position.

<[ArmMotor v] ¿está hecho?>

Parámetros

Descripción

motor

The motor to report whether it is finished moving: ArmMotor or PusherMotor.

motor is spinning#

The motor is spinning Boolean block reports whether the motor is spinning. This can be used to control the timing of other behaviors based on the motor’s movement.

  • True — The motor is spinning.

  • False — The motor is not spinning.

This block works together with the following Motion blocks that have the and don’t wait parameter: spin motor for and spin motor to position.

<[ArmMotor v] esta girando?>

Parámetros

Descripción

motor

The motor to report whether it is spinning: ArmMotor or PusherMotor.

velocidad del motor#

The motor velocity reporter block reports how fast the motor is spinning, as a percentage from -100% to 100%.

([ArmMotor v] velocity in [% v] :: custom-motion)

Parámetros

Descripción

motor

The motor to report the velocity of: ArmMotor or PusherMotor.

unidad

The unit to report the motor velocity in: %.

Visión por IA#

Comportamiento#

obtener datos del objeto#

El bloque obtener datos de objeto filtra los datos del marco del sensor de visión de IA. El sensor de visión de IA puede detectar elementos del juego en el campo.

El conjunto de datos almacena objetos ordenados de mayor a menor ancho, comenzando en el índice 0. Se puede acceder a las propiedades de cada objeto mediante el bloque Propiedad del objeto AI Vision. Se devuelve un conjunto de datos vacío si no se detectan objetos coincidentes.

El bloque de pila Obtener datos del objeto.#
get [AI Classifications v] data from [AIVision v]

Parámetro

Descripción

firma

Filtra el conjunto de datos para incluir solo datos de la firma dada. La única firma disponible es:

  • Clasificaciones de IA: detecta goles móviles, anillos rojos y anillos azules

Ejemplo

cuando empezó
[Spin the Arm Motor up so that the AI Vision Sensor is not blocked.]
spin [ArmMotor v] [up v] for [270] [degrees v] ▶
get [AI Classifications v] data from [AIVision v]
[Check if any AI Classifications were detected in the last snapshot.]
if <[AIVision v] object exists?> then
[Only if an AI Classification is detected, then print data from the largest AI Classification.]
print [Largest object's width:] ▶
print ([AIVision v] object [width v]) ◀ and set cursor to next row
fin

Ajustes#

elemento de objeto de conjunto#

El bloque establecer elemento de objeto establece qué elemento del conjunto de datos se debe utilizar.

El bloque de pila de elementos del objeto Set AI Vision.#
set [AIVision v] object item to [1]

Parámetros

Descripción

artículo

El número del elemento del conjunto de datos que se va a utilizar.

Ejemplo

cuando empezó
[Spin the Arm Motor up so that the AI Vision Sensor is not blocked.]
spin [ArmMotor v] [up v] for [270] [degrees v] ▶
get [AI Classifications v] data from [AIVision v]
[Check if any AI Classifications were detected in the last snapshot.]
if <[AIVision v] object exists?> then
[If any AI Classification is detected, check if any of them are a Mobile Goal.]
if <[AIVision v] AI Classification is [MobileGoal v]?> then
print [Mobile Goal is detected.] ▶
demás
print [Mobile Goal is not detected.] ▶
fin
fin

Valores#

object exists#

The object exists block returns a Boolean indicating whether any object is detected in the dataset.

  • Verdadero: el conjunto de datos incluye un objeto detectado.

  • Falso: el conjunto de datos no incluye ningún objeto detectado.

El objeto AI Vision existe como bloque booleano.#
<[AIVision v] object exists?>

Parámetros

Descripción

Este bloque no tiene parámetros.

Ejemplo

cuando empezó
[Spin the Arm Motor up so that the AI Vision Sensor is not blocked.]
spin [ArmMotor v] [up v] for [270] [degrees v] ▶
get [AI Classifications v] data from [AIVision v]
[Check if any AI Classifications were detected in the last snapshot.]
if <[AIVision v] object exists?> then
print ([AIVision v] object count) ◀ and set cursor to next row
fin

La clasificación de IA es#

The AI Vision object is block returns a Boolean indicating whether a detected object matches a specific classification.

  • Verdadero: el elemento en el conjunto de datos es el objeto específico.

  • Falso: el elemento en el conjunto de datos no es el objeto específico.

La clasificación de IA de visión artificial es un bloque booleano de objetos.#
<[AIVision v] object is [MobileGoal v]?>

Parámetro

Descripción

objeto

¿Con qué objeto comparar el elemento?:

  • MobileGoal
  • RedRing
  • BlueRing

Ejemplo

cuando empezó
[Spin the Arm Motor up so that the AI Vision Sensor is not blocked.]
spin [ArmMotor v] [up v] for [270] [degrees v] ▶
get [AI Classifications v] data from [AIVision v]
[Check if any AI Classifications were detected in the last snapshot.]
if <[AIVision v] object exists?> then
[If any AI Classification is detected, check if any of them are a Mobile Goal.]
if <[AIVision v] AI Classification is [MobileGoal v]?> then
print [Mobile Goal is detected.] ▶
demás
print [Mobile Goal is not detected.] ▶
fin
fin

recuento de objetos#

El bloque conteo de objetos devuelve el número de objetos detectados en el conjunto de datos como un número entero.

El bloque de pila de elementos del objeto Set AI Vision.#
([AIVision] object count)

Parámetros

Descripción

Este bloque no tiene parámetros.

Ejemplo

cuando empezó
[Spin the Arm Motor up so that the AI Vision Sensor is not blocked.]
spin [ArmMotor v] [up v] for [270] [degrees v] ▶
get [AI Classifications v] data from [AIVision v]
[Check if any AI Classifications were detected in the last snapshot.]
if <[AIVision v] object exists?> then
print ([AIVision v] object count) ◀ and set cursor to next row
fin

propiedad del objeto#

Hay seis propiedades que se incluyen con cada objeto (que se muestra a continuación) almacenadas después de que se utiliza el bloque obtener datos del objeto.

El bloque de informe de propiedades del objeto AI Vision.#
([AIVision v] object [width v])

Algunos valores de propiedad se basan en la posición del objeto detectado en la vista del sensor de visión artificial en el momento en que se utilizó el bloque obtener datos del objeto. El sensor de visión artificial tiene una resolución de 320 x 240 píxeles.

Parámetro

Descripción

propiedad

¿Qué propiedad del objeto detectado utilizar?:

ancho#

El parámetro width devuelve el ancho del objeto detectado en píxeles como un número entero entre 1 y 320.

El bloque de pila de propiedades del objeto AI Vision con su parámetro establecido en ancho.#
([AIVision v] object [width v])

Ejemplo

cuando empezó
[Spin the Arm Motor up so that the AI Vision Sensor is not blocked.]
spin [ArmMotor v] [up v] for [270] [degrees v] ▶
get [AI Classifications v] data from [AIVision v]
[Check if any AI Classifications were detected in the last snapshot.]
if <[AIVision v] object exists?> then
[Only if an AI Classification is detected, then print data from the largest AI Classification.]
print [Largest object's width:] ▶
print ([AIVision v] object [width v]) ◀ and set cursor to next row
fin
altura#

La función height devuelve la altura del objeto detectado en píxeles como un número entero entre 1 y 240.

El bloque de pila de propiedades del objeto AI Vision con su parámetro establecido en altura.#
([AIVision v] object [height v])
centroX#

centerX devuelve la coordenada x del centro del objeto detectado en píxeles como un número entero entre 0 y 320.

El bloque de la pila de propiedades del objeto AI Vision con su parámetro establecido en centerX.#
([AIVision v] object [centerX v])
centroY#

centerY devuelve la coordenada y del centro del objeto detectado en píxeles como un número entero entre 0 y 240.

El bloque de la pila de propiedades del objeto AI Vision con su parámetro establecido en centerY.#
([AIVision v] object [centerY v])
origenX#

originX devuelve la coordenada x de la esquina superior izquierda del cuadro delimitador del objeto detectado en píxeles como un número entero de 0 a 320.

El bloque de la pila de propiedades del objeto AI Vision con su parámetro establecido en originX.#
([AIVision v] object [originX v])
origenY#

originY devuelve la coordenada y de la esquina superior izquierda del cuadro delimitador del objeto detectado en píxeles como un número entero de 0 a 240.

El bloque de la pila de propiedades del objeto AI Vision con su parámetro establecido en originY.#
([AIVision v] object [originY v])

Detección#

Óptico#

Optical found an object#

The Optical found an object Boolean block reports whether or not the Optical Sensor detects an object within range.

  • True — The Optical Sensor detects an object.

  • False — The Optical Sensor does not detect an object.

<[FrontOptical v] found an object?>

Parámetros

Descripción

Este bloque no tiene parámetros.

Optical detects color#

The Optical detects color Boolean block reports whether the Optical Sensor detects a specified color, based on the detected hue value.

  • True – The sensor detects the specified color.

  • False – The sensor does not detect the specified color.

Nota: El sensor óptico busca rangos de tonalidad que coincidan con el color especificado. Para detectar rangos de tonalidad específicos, consulte el bloque Tonalidad óptica.

<[FrontOptical v] detects [red v]?>

Parámetros

Descripción

color

Which color to look for:

  • red – A detected hue value between 340° - 20°.
  • green – A detected hue value between 80° - 140°.
  • blue – A detected hue value between 200° - 240°.
  • yellow – A detected hue value between 40° - 60°.
  • orange – A detected hue value between 20° - 40°.
  • purple – A detected hue value between 240° - 280°.
  • cyan – A detected hue value between 140° - 200°.

Brillo óptico#

The Optical brightness reporter block reports how much light is reflected back to the Optical Sensor, as a percentage from 0% to 100%.

A higher percentage means more light is reflected back to the Optical Sensor. A lower percentage means less light is reflected back.

([FrontOptical v] brightness in %)

Parámetros

Descripción

Este bloque no tiene parámetros.

Tonalidad óptica#

The Optical hue reporter block reports the hue detected by the Optical Sensor as a number from 0 to 359 degrees.

Hue is a way to describe color using numbers around a color wheel.

A circular color wheel displaying a full spectrum of hues labeled with degree values around the perimeter, increasing in 30-degree increments from 0° at the top to 360°.

([FrontOptical v] hue in degrees)

Parámetros

Descripción

Este bloque no tiene parámetros.

cuando óptico#

The when Optical hat block runs the attached stack of blocks whenever the Optical Sensor detects or loses an object.

when [FrontOptical v] [detects v] an object :: hat events

Parámetros

Descripción

estado

When the attached stack of blocks will run: detects runs when an undetected object is detected, while loses runs when a detected object is now no longer detected.

Rotación#

Establecer la posición del sensor de rotación#

El bloque establecer posición del sensor de rotación establece la posición actual del sensor de rotación a un valor en grados.

set [PusherRotation v] position to [0] degrees

Parámetros

Descripción

posición

La posición en la que se debe colocar el sensor de rotación.

Ejemplos

cuando empezó
[Make lower Pusher position the new 0 degrees rotation position.]
spin [PusherMotor v] [lower v] for [270] [degrees v] ▶
set [PusherRotation v] position to [0] degrees

Ángulo del sensor de rotación#

El bloque Ángulo del sensor de rotación devuelve el ángulo actual del sensor, que oscila entre 0 y 359,99 grados.

([PusherRotation v] angle in degrees)

Parámetros

Descripción

Este bloque no tiene parámetros.

Ejemplos

cuando empezó
[Make lower Pusher position the new 0 degrees rotation position.]
spin [PusherMotor v] [lower v] for [270] [degrees v] ▶
print ([PusherRotation v] angle in degrees) ▶

Posición del sensor de rotación#

El bloque Posición del sensor de rotación devuelve la posición de rotación total en grados o vueltas.

([PusherRotation v] position in [degrees v] :: custom-sensing)

Parámetros

Descripción

unidades

The rotation unit: degrees or turns.

Ejemplos

cuando empezó
[Make lower Pusher position the new 0 degrees rotation position.]
spin [PusherMotor v] [lower v] for [270] [degrees v] ▶
print ([PusherRotation v] position in [degrees v] :: custom-sensing) ▶

GPS#

posición GPS#

El bloque Posición GPS devuelve el desplazamiento posicional del punto de referencia de giro del robot desde el centro de un campo con el sensor GPS (Game Positioning System™).

([GPS v] position [X v] in [mm v])

Parámetros

Descripción

eje

¿Qué eje reportar?:

  • X
  • Y

unidades

The unit to represent the position: mm or inches

rumbo GPS#

El bloque rumbo GPS devuelve el rumbo hacia el que apunta actualmente el robot en función de las lecturas del sensor GPS (Game Positioning System™) del código de campo GPS VEX, desde 0,00 hasta 359,99 grados.

([GPS v] heading in degrees)

Parámetros

Descripción

Este bloque no tiene parámetros.