How terrencelei/autonomous-shopping-cart works
This repository is an autonomous shopper-following cart: camera detections are converted into target distance and angle, the Pi follower computes wheel commands, and ESP32 firmware drives the motors and reports encoder counts. A separate straight-line follower shares vision and motor protocol; vision also has a color-vector collection and weight-training branch. The main follower, vision, and tooling excerpts support these boundaries; firmware behavior and some subsystem details are represented only by README statements, so those links cite the README.
Main entry points: yolo_detect.py Detection and tracking · follow.py Serial motor I/O · follow_straight.py Straight follower · cart_motor.ino ESP32 motor controller
Components 14
Vision and tracking
- Detection and tracking
vision/yolo_detect.py
Cart following
- Reactive follower
follow.py - Straight follower
follow_straight.py - Serial motor I/O
follow.py - Damped control and odometry
follow.py - Distance controller
follow_straight.py
Motor hardware
- ESP32 motor controller
firmware/cart_motor/cart_motor.ino - Drive motors and encoders
Color re-identification tools
- Color-vector collector
vision/collect_vectors.py - Labeled color vectors
vision/vectors.csv - Re-identification trainer
vision/vision_weight_trainer.py - HSV chunk weights
vision/weights_by_hsv_chunk.csv
Other components
- Designated shopper
- IMX500 camera
Connections 16
- Designated shopper → IMX500 camera: appears before
README.md - IMX500 camera → Detection and tracking: provides frames and detections
README.md - Detection and tracking → Reactive follower: supplies target and obstacles
README.md - Reactive follower → Damped control and odometry: computes wheel demands
follow.py - Reactive follower → Serial motor I/O: sends commands and reads feedback
follow.py - Serial motor I/O → ESP32 motor controller: sends RPM commands
README.md - ESP32 motor controller → Serial motor I/O: returns encoder counts
README.md - ESP32 motor controller → Drive motors and encoders: drives and reads
README.md - Straight follower → Detection and tracking: imports tracking
follow_straight.py - Straight follower → Distance controller: computes distance demand
follow_straight.py - Straight follower → Serial motor I/O: uses serial protocol
follow_straight.py - Color-vector collector → IMX500 camera: captures detections
vision/collect_vectors.py - Color-vector collector → Labeled color vectors: appends labeled profiles
vision/collect_vectors.py - Re-identification trainer → Labeled color vectors: loads training data
vision/vision_weight_trainer.py - Re-identification trainer → HSV chunk weights: writes weights
vision/vision_weight_trainer.py - HSV chunk weights → Detection and tracking: optional inference calibration