Distributed AI Micromouse
A research project comparing tabular Q-Learning against Deep Q-Learning on resource-constrained edge hardware, built as five ROS2 packages around maze-solving microrobots.
- ROS2 packages
- Five
- Nodes
- Nine, across four packages
- Message contract
- 6 messages · 4 services · 1 action
- Phases complete
- Two of three
- Context
- University research · AI systems course
- Maintainer
- Muhammad Adil Khan
- Period
- 2026 — Present
- Research direction
- Q-Learning vs Deep Q-Learning on resource-constrained edge devices
- Shape
- Five ROS2 packages · nine nodes · one declared message contract
- Status
- Phases 1 and 2 complete · experiments not yet run
- Visibility
- Public repository · MIT licensed · no results reported
Covers
Stack
- Python
- ROS2
- PyTorch
- NumPy
- Streamlit
- TensorFlow Lite
- ESP32
The research question
How do tabular Q-Learning and Deep Q-Learning compare on a genuinely resource-constrained device — not just in how well they learn, but in what they cost to run: compute, memory, inference time, communication, and how well a policy transfers to a maze it has not seen.
The framing matters because the two are usually compared on the learning axis alone, where the neural method wins by construction. On a microcontroller the interesting question is different: a table that fits in flash and needs no floating-point inference may be the better engineering answer even when it generalizes worse.
The longer-term direction is to extend that comparison across several robots learning at once, and to measure what the coordination itself costs. The phases below mark what is built and what is not.
- 01
Foundation
Complete- Project architecture
- ROS2 package setup
- DQN training node
- Dashboard
- Simulation environment
- 02
Tabular path & benchmarking
Complete- Tabular Q-Learning trainer
- Flash persistence strategy
- State discretization
- Epsilon-greedy exploration
- Q-table visualization
- DQN vs Q-Learning benchmark tooling
- 03
Hardware & experiments
Upcoming- ESP32 hardware integration
- Real-world comparative experiments
- Multi-robot federated learning
- Generalization analysis
- Publication-ready performance analysis
System architecture
The project is organized as five ROS2 packages: shared messages, training, dashboard, robot control, and simulation. A robot — simulated or physical — publishes over ROS2 topics to a training server, which produces models and metrics that the dashboard reads.
Splitting messages into their own package is the load-bearing decision. Every other package depends on the contract rather than on each other, which is what allows the simulated robot and a physical one to be interchangeable from the training server's point of view.
The three flows run at different rates for good reason: state is frequent because it drives control, experience is less frequent because it drives learning, and telemetry is slow because nobody needs battery voltage ten times a second. Quality-of-service profiles are configuration rather than code, which is what a lossy radio link to a microcontroller eventually requires.
Packages
micromouse_msgs_package
Shared message types
training_package
DQN and Q-Learning trainers
dashboard_package
Streamlit monitoring surface
robot_package
Robot-side control
simulation_package
Physics-based environment
Robot / simulation
Publisher
ROS2 topics
Messaging layer
Training server
PC-side
Model / metrics
Versioned artifacts
Dashboard
Analysis surface
Experience replay
Sampling buffer
Model manager
Versioning
Experiment manager
Run control
Data flow
- StatePosition and sensor readings
/mouse/stateTraining server - ExperienceState, action, reward, next state, done
/mouse/experienceModel updates - TelemetryProcessor load, free memory, battery
/mouse/telemetryDashboard
The interface, declared
The interface between parts is written down as message, service and action definitions rather than left as whatever the publisher happened to send. Six message types, four services and one long-running action.
Three of those four services exist for a single purpose: moving a model between a trainer and a device. One uploads weights, one fetches the current global model, and one fetches it in chunks. That third call is the whole federated design in miniature — a microcontroller cannot receive a model the way a workstation can, so the contract admits it up front.
Messages
- State
- Action command
- Experience
- Telemetry
- Training metrics
- Model version
Services
- Reset maze
- Upload weights
- Get global model
- Get model chunk
Actions
- Run episode
Training nodes
- Training server — deep
- Q-Learning trainer — tabular
- Model manager — versioning
Robot & simulation
- Robot coordinator
- Experiment manager
- Physics simulator
- Synthetic data generator
Dashboard
- Metrics bridge
- Streamlit interface
The interface is declared rather than assumed. Three of the four services exist specifically to move a model between a trainer and a device — upload, fetch, and fetch in chunks.
Q-Learning vs Deep Q-Learning
Both training paths are implemented. The tabular trainer discretizes state, explores with an epsilon-greedy schedule, and persists a table small enough to live in the device's own flash. The deep trainer approximates the same values with a network, stabilized by a replay buffer and a target network, trained in PyTorch on a workstation.
They trade compute against generalization, which is precisely what the experiments are meant to measure. A table is fast, cheap and specific to the maze it learned; a network is expensive to train, needs floating-point inference, and stands a chance of transferring to a maze it has never seen.
Which one suits a constrained device better is a question this project has not answered yet. No winner is declared here, and no comparative figure is reported, because the comparison has not been run and recorded.
Q-Learning
- Tabular method
- Lower compute requirements
- Suitable for constrained devices
- Fast in known, discrete environments
- Limited generalization
- Persists to device flash
Deep Q-Learning
- Neural-network Q approximation
- Replay buffer
- Target network
- Higher resource requirements
- Stronger generalization potential
- Trained on a workstation, converted for the edge
- Tabular
- vs
- Neural
- Edge constraints
- Generalization
Getting it onto the device
Deploying a policy to a microcontroller is its own problem, and the repository treats it as one rather than as a final step. A model trained in PyTorch is converted to TensorFlow Lite, versioned by a model manager, and fetched by the device — in pieces, through the chunked service, because it cannot hold the transfer in memory otherwise.
The tabular path needs none of that. A Q-table is small enough to write straight to flash, which is the practical half of the comparison: not only which algorithm learns better, but which one can actually be deployed and updated on the hardware in question, and what each update costs in flash wear.
A firmware sketch is committed and a converted model sits in the repository, so the path exists end to end in source. The hardware experiments themselves have not been run.
Training server
PyTorch, on a workstation
Trained model
Versioned by the model manager
Conversion
PyTorch → TensorFlow Lite
Chunked transfer
A service call per piece
ESP32
Inference at the edge
Flash storage
Where the tabular path lives
What would be measured
The instrumentation is in place and the measures are chosen. Hardware telemetry covers processor load, free memory, battery voltage, inference time and flash write cycles; training telemetry covers loss, episode reward, exploration decay and buffer size; and three maze layouts of increasing difficulty are defined for testing transfer.
These are targets, not findings. They describe what the experiments are designed to capture, and no value for any of them is reported on this page.
Hardware
- Processor load
- Free memory
- Battery voltage
- Inference time
- Flash write cycles
Training
- Loss
- Episode reward
- Exploration decay
- Replay buffer size
Generalization scenarios
- Simple maze
- Complex maze
- Open maze
These are the measures the experiments are designed to capture, not results. No benchmark figures, accuracy numbers or comparative outcomes are reported on this page.
What the tooling can and cannot prove
The analysis tooling is genuinely built: a Q-table visualizer producing heatmaps, coverage maps, per-action panels and policy views; a comparative benchmark tool producing learning curves, resource comparisons and performance tables; and a dashboard showing all of it live. Everything renders at publication resolution.
It also has a mode that generates all of that from synthetic data, alongside a synthetic data generator in the simulation package. That exists for good reasons — you cannot develop a plotting pipeline while waiting on hardware — but it means a finished-looking comparison from this repository is not evidence of anything until it says which data produced it.
That is why no figure from this project appears on this page, and why any that is published later should carry its provenance on its face.
- 01Both training paths implemented — deep and tabular
- 02A conversion utility, and a converted edge model committed
- 03A physics-based simulator, plus a synthetic data generator
- 04Verification scripts for the system and for the data flow
- 05Publication-resolution plotting for Q-tables and comparisons
- 06The benchmark tool runs on recorded sessions or on synthetic data
Known-data KPI test
- Episode run
- Experience published
- Replay buffer
- Model updated
- Metrics recorded
- Figure generated
The last point is the one that matters when reading any figure from this project: the benchmark tool can produce a complete, publication-styled comparison from synthetic data. No plot made that way is a result, and no result from either training path is reported here.
The federated direction
The federated work is a direction with a contract, not a completed result. The service definitions for uploading weights and distributing a global model exist; the intended arrangement is several simulated robots alongside one physical one, with local adaptation on each and aggregation at the centre.
The measure that would make it research rather than plumbing is communication efficiency — what the coordination costs relative to what it buys. Nothing below has been run, and every row is marked accordingly.
- Simulated robots
- 4 · planned
- Physical robot
- 1 · planned
- Centralized aggregation
- Contract only
- Local adaptation / probing
- Planned
- Communication-efficiency analysis
- Planned
The environment is the result
For a project whose output is meant to be research, the environment is not setup detail — it is part of the finding. A comparison of memory use and inference time means very little if a reader cannot determine which toolchain and which versions produced it.
Two things need settling before any number is published. The setup instructions name two different ROS2 releases in different places, and several of the guides the README links to are not in the repository. Neither is difficult to fix, and both would undermine a published figure if left as they are.
Known gap
A reproducible research environment
- Status
- Setup paths name two different ROS2 releases, and several guides the README links are not committed
- Next improvement
- Pin one release, commit the build guide, and record exact versions before publishing any figure
What holds, and what does not
The repository is public, so the left column below can be checked rather than trusted: the packages, the nodes, the declared contract, both training paths, the conversion utility and the committed converted model are all there to read.
The right column is the part that keeps this a project rather than a paper. No comparative run has been recorded, no hardware measurement taken, no federated experiment performed, and no maze held out to test transfer. The gap between a system that could produce results and results is exactly the work that remains.
Verified
- The five-package structure and its declared message contract
- Both training paths exist and are implemented
- Simulation, dashboard and conversion tooling are present
- A converted edge model and a firmware sketch are committed
Not verified
- Any comparative result — no benchmark has been run and recorded
- Hardware behaviour — the device experiments have not been run
- Federated aggregation — the contract exists, the experiment does not
- Generalization — the maze scenarios are defined, not executed
Next proof
- A pinned environment
- One recorded run
- Hardware measurements
- A held-out maze
Current status
Phases 1 and 2 are complete: the architecture, both training paths, the simulation, the dashboard and the analysis tooling all exist and run.
Phase 3 — hardware integration, the comparative experiments, the federated work and the analysis that would follow — is ahead. It is listed here as outstanding rather than folded into a summary that would read as finished.
- Phase 1
- Complete
- Phase 2
- Complete
- Analysis tooling
- Built
- Phase 3
- Upcoming
- Hardware validation
- Pending
- Federated experiments
- Pending
- Reported results
- None
Analysis Tooling
Q-table visualization
- Max Q-value heatmap
- Exploration coverage map
- Per-action Q-value panels
- Greedy policy visualization
- Convergence statistics
Benchmark comparison
- Learning curves
- Deep vs tabular comparison
- Memory use
- Inference time
- Model size
- Runs on recorded or synthetic data
Dashboard
- Loss curves
- Reward plots
- Hardware metrics
- Maze heatmaps
- Model version tracking
The tooling can generate high-resolution figures suitable for research analysis and publication preparation. No figures are reproduced on this page — none have been produced from a completed experimental run, and nothing here has been submitted or published.
Evidence boundary
Supported
The repository is public. It shows a five-package ROS2 architecture with a declared message, service and action contract; both a Deep Q-Learning and a tabular Q-Learning training path; a model manager; a physics-based simulator and a synthetic data generator; a Streamlit dashboard; PyTorch to TensorFlow Lite conversion with a converted model committed; verification scripts; and publication-quality plotting tools.
Not overstated
No comparative result is reported, because none has been run and recorded. The hardware experiments, the multi-robot federated experiments and the generalization analysis are all outstanding. The benchmark tool can render a finished-looking comparison from synthetic data, so no figure from this project should be read as a finding. I claim no publication, and no contribution split is stated because none is documented.
Technical notes
The project builds as five ROS2 packages with colcon, holding QoS profiles and training hyperparameters in committed YAML rather than in code. The documentation currently names two different ROS2 releases across its setup paths, and several of the guides its README links to are not committed; the reproducible research environment should be standardized and recorded before any result is published.
Core stack
- Python
- ROS2
- PyTorch
- NumPy
- Pandas
- Streamlit
- TensorFlow Lite
Interface contract
- Six message types
- Four services
- One action
- QoS profiles in committed YAML
Edge & hardware
- ESP32
- Chunked model transfer
- Flash persistence
- Firmware sketch committed
Simulation & build
- Physics-based robot simulator
- Synthetic data generator
- colcon
- Verification scripts
Analysis
- Q-table visualizer
- Benchmark comparison
- Recorded-session processor
- Publication-resolution output
- Repository
- Public
- Public artifacts
- Architecture figures, simulation screenshots, robot images, dashboard captures, Q-table plots and benchmark plots can be added once produced from real runs — and should be labelled as such when they are.
Source
View Public RepositoryContributors
Rafay Khattak
Portfolio project contributor / researcher
Muhammad Adil Khan
Maintainer