AIM WebSocket Differences#
This page outlines key differences between the WebSocket-based Python API and the VEXcode AIM Python API. It includes added functionality, removed classes, and support for advanced use cases such as multi-robot control.
Additional Methods#
play_local_file#
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)
Parameters |
Description |
---|---|
filepath |
A string specifying the path to a |
volume |
Optional. The playback volume as a percentage 0 to 100. Default is 100. |
To view an implementation example, open play_sounds.py
get_camera_image#
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()
Parameters |
Description |
---|---|
This method has no parameters |
To view an implementation example, see stream_video.py
.
Use Multiple Robots Simultaneously#
You can connect to multiple robots by manually specifying each robot’s IP address when creating Robot
objects.
Usage:
Robot(address)
Parameters |
Description |
---|---|
address |
Optional. The IP Address of the robot. If omitted, the address in the |
To view an implementation example, open multiple_robots.py
.
Removed Classes#
The following classes available in the VEXcode Python API are not available in the WebSocket version:
Controller
Event
Features Only Available in VEXcode#
The following features are not currently supported via the AIM WebSocket API and require connecting through VEXcode AIM:
Updating the robot’s firmware
Uploading custom images
Uploading custom sounds
Robot to robot messaging