A Webots-based autonomous package sorting system using a UR10e robotic arm, YOLO-based package detection, OCR + CLIP verification, and a joint-sensor-driven finite state machine (FSM) for reliable pick-and-place operations.
This project demonstrates a practical end-to-end robotics pipeline: perception → reasoning → manipulation → supervision.
- Custom-trained YOLOv8 package detector (no suitable pretrained model existed)
- Webots Supervisor-based simulation
- Single-package perception pipeline (robust against ID duplication)
- OCR + fuzzy matching + CLIP verification to reduce false label reads
- 6-DOF UR10e joint control (no IK, no hallucinated APIs)
- Joint-sensor–driven FSM (no timers, no heuristics)
- Conveyor belt control synchronized with robot actions
- Dynamic package spawning with safe spacing
- Extensible architecture (GUI overlay, analytics, multi-arm support)
There is no reliable pretrained computer vision model that can:
- Detect generic cardboard packages
- Work inside Webots
- Support industrial sorting logic
Existing object detectors (COCO, OpenImages, etc.) do not include a “package” class suitable for logistics scenarios.
Therefore, a custom dataset and training pipeline was required.
There is no pretrained YOLO model that reliably detects shipping packages. As a result, a custom dataset had to be created inside Webots.
A custom Webots controller was written to:
- Capture RGB images from the camera
- Save bounding boxes / segmentation labels
- Export images + annotations to disk
These images were then prepared for training using Ultralytics YOLOv8 segmentation format.
Dataset format followed:
📎 https://docs.ultralytics.com/datasets/segment/package-seg/
package-seg/
├── images/
│ ├── train/
│ ├── val/
├── labels/
│ ├── train/
│ ├── val/
├── dataset.yaml
Ultralytics does not download required files until the first training run.
To resolve this:
-
A single-epoch training run was executed:
yolo segment train model=yolov8n-seg.pt data=dataset.yaml epochs=1
-
This triggered:
- Automatic directory creation
- Cache setup
- Metadata generation
-
After that, custom Webots images and labels were added into:
images/train labels/train -
Training was then resumed normally.
After data insertion:
yolo segment train \
model=yolov8n-seg.pt \
data=dataset.yaml \
epochs=50 \
imgsz=640The resulting model is used as:
best.pt
┌───────────┐
│ Conveyor │
└─────┬─────┘
│
┌─────▼─────┐
│ Camera │
│ (Webots) │
└─────┬─────┘
│
┌─────▼───────────┐
│ YOLOv8 Detector │ ← custom-trained
└─────┬───────────┘
│
┌─────▼───────────────┐
│ OCR (EasyOCR) │
│ + Fuzzy Matching │
│ + CLIP Verification│
└─────┬───────────────┘
│
┌─────▼───────────────┐
│ Destination Lock │
└─────┬───────────────┘
│
┌─────▼───────────────┐
│ PickFSM (Joint-based│
│ Finite State Machine│
└─────┬───────────────┘
│
┌─────▼──────────┐
│ UR10e Arm │
│ (6-DOF joints) │
└─────┬──────────┘
│
┌─────▼──────────┐
│ Plastic Crates │
│ (Destinations) │
└────────────────┘
Webots R2023b:
- ❌ No
inverseKinematics - ❌ No
endEffectorfield - ❌ No
childrenfield on UR10e PROTO
Instead of:
- Timers ❌
- Wrist heuristics ❌
- Magic constants ❌
I used:
- All 6 joint sensors
- Target joint convergence
- Distance sensor for release confirmation
IDLE
→ GRASP
→ MOVE_TO_BIN (wait until ALL joints reach target)
→ RELEASE (open gripper)
→ WAIT_RELEASE_CLEAR (distance sensor)
→ MOVE_HOME (wait until ALL joints reach HOME)
→ IDLE
✔ Deterministic ✔ Physics-safe ✔ Conveyor synchronized
- RUN while scanning and detecting
- STOP immediately when pick starts
- RESUME only after arm returns HOME
This ensures:
- No missed packages
- Stable OCR
- Safe manipulation
{
"london": [3.9, -0.8, 0.50, -2.50, -1.28, 0.05],
"manchester": [3.5, -0.8, 0.50, -0.20, -1.48, 0.05],
"sheffield": [0.02, -1.78, -1.90, -1.55, 1.52, -0.01],
"leeds": [2.2, -0.8, 0.50, -1.30, -1.48, 0.05],
"lagos": [1.7, -0.4, 0.50, -2.50, -1.28, 0.05]
}Overrides default joint targets.
- Webots R2023b
- Python 3.9+
- Ultralytics YOLOv8
- OpenCV
- EasyOCR
- PyTorch
- Transformers (CLIP)
pip install ultralytics opencv-python easyocr torch transformers- GUI overlay (counts per destination, last OCR text)
- Multi-package tracking
- Dynamic bin calibration
- Real robot deployment (ROS 2 bridge)
- Vision-language grounding improvements
MIT License
Abiola Oluwaseun Onasanya
MSc Artificial Intelligence - Advanced Robotics and Artificial Intelligence
Sheffield Hallam University