Library Overview
Understand the architecture and core concepts behind the UNI library.
Architecture
The UNI ecosystem is designed for the UniBase robotic platform. It consists of two main components:
1. UniBase (ESP32)
The core library runs on the ESP32 microcontroller onboard the robot. It handles:
- Motor PID Control: Ensures precise speed and distance using encoders.
- Odometry: Calculates position (X, Y) relative to the start point.
- Hardware Abstraction: Manages OLED, LEDs, voltage sensors, and IMU.
2. UniBaseControl (Arduino Nano / Remote)
An optional library for controlling the robot from a secondary processor via UART.
- Sends high-level commands (e.g., "move 100mm") to the ESP32.
- Receives sensor data (odometry, battery) from the ESP32.
- Ideal for educational kits where students program an Arduino Nano plugged into the robot.
Core Concepts
Non-Blocking Operations
Most movement commands in the UNI library (like moveDist or rotate) are
designed to be intuitive.
However, under the hood, the ESP32 uses FreeRTOS tasks to handle high-frequency PID loops without
blocking your main code.
Coordinate System
The robot uses a standard 2D cartesian coordinate system:
- X Axis: Forward direction from the starting point.
- Y Axis: Left direction from the starting point.
- Angle (Theta): 0 degrees is facing forward. Positive angles turn counter-clockwise (Left), negative angles turn clockwise (Right).
Robot Name
You can assign a custom name to your robot during initialization. This name is displayed on the OLED screen startup.
robot.begin("WALL-E");