Skip to main content

Introduction

The Robotics Integration system provides hardware control and sensor management for the Trash Classification AI System. Built on the VEX IQ2 platform, it enables precise manipulation of objects and real-time environmental scanning through a coordinated robotic arm.

VEX Controller Capabilities

The system leverages VEX IQ2 hardware to provide:
  • 4-Axis Robotic Arm Control: Base rotation, shoulder, elbow, and gripper motors
  • Multi-Sensor Integration: Distance sensors, bumper switches, inertial measurement unit, and LED indicators
  • Real-time Processing: Immediate sensor data processing and motor control responses
  • Serial Communication: JSON-based protocol for Raspberry Pi integration

System Services

The robotics controller provides three core services managed by the RoboticServices class:

Check Service

Validates all motors and sensors are properly installed and operational before system startup

Safety Service

Performs sequential safety checks on shoulder and gripper mechanisms with emergency stop capabilities

Scan Service

Executes 360° environmental scan to detect and map objects with position and size data

Service Architecture

All services communicate via JSON messages over serial connection:
# Service request from Raspberry Pi
{
    'type': 'check_service',  # or 'safety_service', 'scan_service'
    'data': {}
}

# Service response to Raspberry Pi
{
    'type': 'check_service',
    'data': {
        'state': 'approved'  # or error details
    }
}

Hardware Components

Motors (Port Configuration)

MotorPortFunctionDirection
Base MotorPORT1360° rotation for scanningReversed
Shoulder MotorPORT2Vertical arm positioningReversed
Elbow MotorPORT3Arm extension/retractionReversed
Gripper MotorPORT4Object graspingReversed

Sensors (Port Configuration)

SensorPortFunctionRange
Gripper DistancePORT7Object detection in gripper0-400mm
TouchLEDPORT10Visual status indicatorRGB color
Base DistancePORT11Environment scanning50-300mm detection zone
BumperPORT12Shoulder collision detectionBinary pressed/not pressed
InertialBuilt-inRotation angle tracking0-360°

LED Status Indicators

The system uses the TouchLED sensor for visual status feedback:
class LEDColors:
    ERROR = (255, 0, 0)             # Red: Error/Stop
    WARNING = (255, 150, 0)         # Orange: Warning
    READY = (0, 255, 0)             # Green: Ready
    RUNNING = (0, 0, 255)           # Blue: Process Running
    OBJECT_DETECTED = (0, 255, 155) # Cyan: Object Detected
ColorStatusMeaning
RedERRORSystem error or emergency stop activated
OrangeWARNINGSafety check in progress
GreenREADYSystem operational and ready
BlueRUNNINGActive scanning or operation
CyanOBJECT_DETECTEDObject detected within range

Module Architecture

The robotics system is organized into specialized modules:
1

SensorModule

Low-level sensor interface for distance, bumper, inertial, and display operations
2

ControlModule

Motor control with forward/reverse rotation and current monitoring
3

SafetyModule

Hardware validation and emergency stop mechanisms
4

PerceptionModule

Object detection logic based on distance sensor data
5

MappingModule

Spatial mapping of detected objects with angular positioning
6

CommunicationManager

Serial protocol handling for Raspberry Pi integration
7

RoboticServices

Main orchestrator coordinating all modules and services

Quick Start

from vex import *
from main import RoboticServices

if __name__ == "__main__":
    arm_process = RoboticServices()
    arm_process.run()  # Starts main control loop
The VEX controller runs MicroPython and requires the VEX library. Ensure all hardware is properly connected before running services.

Next Steps

Arm Controller

Detailed RoboticServices class documentation

Serial Communication

JSON protocol and message handling

Safety System

Safety checks and emergency procedures

Build docs developers (and LLMs) love