How adimogli2/airobot works
Main Components
• Hardware Devices: Represent the physical components such as the Rev Robotics Expansion Hub, motorized wheels (mecanum wheels), and the FTC chassis. Although these are external to the software, they are critical to the overall system.
• Communication & Control Layers:
• HTTP Server: The “src/main/java/AIRobot/HttpServer” package contains handlers for various HTTP requests (e.g., EchoGetHandler, EchoPostHandler, RootHandler). This server is the communication bridge between the Driver Station (MacBook) and the robot’s control system.
• Command Processing: The “src/main/java/AIRobot/commands” package defines different commands (e.g., PingCommand, MotorPowerCommand, etc.) for handling robot operations, translating external requests into actionable instructions.
• Device Utilities and Hardware Abstraction: The “src/main/java/AIRobot/DeviceUtil” and “src/main/java/AIRobot/devices” packages encapsulate interactions with the motors and other hardware components.
• USB Interface: The “src/main/java/AIRobot/usb” package (with classes like UsbInterface and TimeWindow) deals with the details of communicating with the Expansion Hub using USB.
• Utility Components: The “src/main/java/AIRobot/util” package includes helper classes for buffering, message handling, and error/exception management (e.g., BulkPacketBuffer, ReadBufferWorker, RobotCoreException).
Relationships and Interactions
• The Driver Station sends commands via HTTP (over Wi-Fi) to the Raspberry Pi.
• The HTTP server component receives these requests and routes them to the corresponding command handlers.
• Command handlers (located in the “commands” package) interpret the instructions and trigger actions in the device abstraction layer.
• The DeviceUtil and devices packages then translate high-level commands into lower-level control signals for the motors and other devices.
• The USB interface bridges these command signals to the physical Expansion Hub, managing the communication protocols.
• Utility classes support reliable data handling and buffering across communication and hardware interfaces.
Architectural Patterns and Design Principles
• Layered Architecture: The software is organized into several layers (HTTP communication, command processing, device abstraction, and hardware interfacing).
• Separation of Concerns: Each package and component (commands, utilities, device management) is separated so that each handles distinct responsibilities.
• Modular Design: With clearly defined packages (for commands, USB operations, and utilities), the system is designed to be modular and extensible.
• Integration with External Tools: The system leverages open-source projects like OpenRC-Turbo and DeepPiCar to manage the hardware interface and model training aspects.
Relevant Technologies, Frameworks, and Libraries
• Java (the primary language)
• Maven (build and dependency management, as indicated by pom.xml)
• An embedded HTTP server (for communication on the Raspberry Pi)
• USB communication protocols (custom reverse-engineered commands for the Rev Robotics Expansion Hub)
• Deep learning model training (for self-driving functionality, though that portion might be integrated externally with Python on the Raspberry Pi)
• External open-source projects like OpenRC-Turbo and DeepPiCar which helped inform the system design