A small, focused toolkit to plan, visualize, and execute paths for our ITU IHFC Bot 2025. It includes:
- A Pygame-CE arena measurement tool to design paths and export commands.
- A pure-pursuit-style follower that runs those paths on the robot.
- A live telemetry UI to visualize sensors and progress over the arena map.
- A complete robot simulator for testing without hardware (see
simulator/).
All tools assume an arena sized 118 cm (W) x 114 cm (H) and share the same coordinate and heading conventions.
Test your code without hardware! The simulator/ folder contains a complete virtual environment:
- Physics-based 2-wheel differential drive robot
- Mock ESP32 with UDP telemetry (encoders, IMU)
- Visual Pygame UI showing robot movement in arena
- Test scripts for calibration and path execution
Quick start simulator:
python .\simulator\simulator_ui.pySee simulator/README.md for full details.
measure_arena.py— Design paths overarena.png, measure distances/angles, export CSVs.move_control_pure_pursuit.py— Follows exported checkpoints on the robot (turn-then-go steps).telemetry_ui.py— Live dashboard: highlights current segment, shows LIDAR/IMU and estimated position.advanced.py— Robot control + telemetry plumbing (motors, gyro integration, LIDAR feed).arena.png— The arena illustration (physical 118 cm x 114 cm).
Requirements:
- Python 3.9+ (Windows recommended)
- pygame-ce
Install dependency (once):
uv pip install pygame-cepython .\measure_arena.pyControls (measurement tool):
- Left click: add checkpoint (polyline)
- Right click: undo last checkpoint
- Shift: snap to 45° increments (preview and on add)
- G: toggle 10 cm grid
- H: toggle help panel
- F: toggle fullscreen
- C: clear checkpoints
- Enter: print path and save CSVs
path.csv: turn_deg, distance_cmcheckpoints_cm.csv: x_cm, y_cm (origin at top-left, y increases down)
- Esc or Q: quit
Notes
- Angles: 0° points up (toward negative Y). First segment’s turn is relative to current facing when run on the robot (gyro reset), not absolute up.
- Scale: Pixels-per-cm derived from image size vs 118×114 cm. If the PNG’s aspect ratio differs, X/Y scales are handled anisotropically; a warning is shown.
Ensure advanced.py is configured for your robot IP and telemetry is flowing.
Follow the exported checkpoints:
python .\move_control_pure_pursuit.py runBehavior
- Uses
checkpoints_cm.csvto compute relative turn and segment distances. - Resets the gyro before the first turn so the robot’s current facing becomes 0°.
- Performs each segment as: relative turn → forward move (with simple tolerances/timeouts).
python .\telemetry_ui.pyWhat you’ll see
- Arena image with the full path; current segment highlighted.
- Estimated robot position along the current segment based on LIDAR delta.
- Live IMU (accel/gyro/heading/temperature) and relative rotation from
advanced.py. - LIDAR distance and freshness.
Controls (telemetry UI)
- R: reload
path.csvandcheckpoints_cm.csv - A: toggle auto-tracking of the current segment
- [ and ]: manual segment index (when auto-tracking is off)
- Esc or Q: quit
- Arena size: 118 cm wide (X), 114 cm tall (Y).
- Origin: top-left of
arena.png. - +X to the right, +Y downward.
- Heading: 0° = up (toward negative Y), 90° = right, 180° = down, 270° = left.
- Robot follower: at start, the current facing is taken as 0° by resetting gyro; first turn uses relative angle from that heading.
path.csv- Columns:
turn_deg,distance_cm - Turn is relative to the previous segment; the first turn is relative to initial facing.
- Columns:
checkpoints_cm.csv- Columns:
x_cm,y_cm - Coordinates in centimeters using the arena conventions above.
- Columns:
- “No telemetry” or stale LIDAR/IMU: check
advanced.pynetwork config (IP/ports) and ensure the Pi is streaming. - PNG aspect ratio mismatch: tool warns and compensates; distances remain correct using different X/Y scales.
- Window doesn’t open or
convert_alphaerror: ensure a display mode exists (we convert afterset_mode).
- Encoder integration and odometry overlay in telemetry UI.
- True continuous pure pursuit (lookahead curvature) in addition to turn-then-go.
- Export/import of multiple named paths.
Internal project code for IHFC Bot 2025. If you plan to reuse externally, please add a license file appropriate for your needs.