Diferencias de AIM WebSocket#

Esta página describe las diferencias clave entre la API de Python basada en WebSocket y la API de Python de VEXcode AIM. Incluye funcionalidades adicionales, clases eliminadas y compatibilidad con casos de uso avanzados, como el control multirobot.

Métodos adicionales#

reproducir_archivo_local#

The play_local_file method plays a sound file that is stored on the computer and outputs the sound through the robot’s speaker. This allows you to play custom .wav or .mp3 files on the robot without needing to upload them.

Usage:
robot.sound.play_local_file(filepath: str, volume = 100)

Parámetros

Descripción

ruta de archivo

A string specifying the path to a .wav or .mp3 file on the computer.

volumen

Opcional. El volumen de reproducción se expresa en un porcentaje de 0 a 100. El valor predeterminado es 100.

To view an implementation example, open play_sounds.py

obtener_imagen_de_cámara#

The get_camera_image method captures the current frame from the robot’s AI Vision Sensor and returns it as a JPEG-compressed bytes object. This is typically used with tools like OpenCV for displaying a live video feed.

Usage:
robot.vision.get_camera_image()

Parámetros

Descripción

Este método no tiene parámetros

To view an implementation example, see stream_video.py.

Utilice varios robots simultáneamente#

You can connect to multiple robots by manually specifying each robot’s IP address when creating Robot objects.

Usage:
Robot(address)

Parámetros

Descripción

DIRECCIÓN

Optional. The IP Address of the robot. If omitted, the address in the host field of settings.json is used by default.

To view an implementation example, open multiple_robots.py.

Clases eliminadas#

Las siguientes clases disponibles en la API de Python de VEXcode no están disponibles en la versión WebSocket:

  • Controller

  • Event

Funciones disponibles únicamente en VEXcode#

Las siguientes funciones no son compatibles actualmente a través de la API AIM WebSocket y requieren conexión a través de VEXcode AIM:

  • Actualización del firmware del robot

  • Subir imágenes personalizadas

  • Subir sonidos personalizados

  • Robot to robot messaging