Skip to content

dotbot/sim: run mari robots on marilib's simulated network and log mari metrics - #336

Draft
trifuns wants to merge 5 commits into
DotBots:mainfrom
trifuns:mari-sim-pydotbot
Draft

trifuns wants to merge 5 commits into
DotBots:mainfrom
trifuns:mari-sim-pydotbot

Conversation

@trifuns

@trifuns trifuns commented Oct 13, 2026 •

Copy link
Copy Markdown

Two changes that let the controller drive robots over a mari network the same way on the bench and in the simulator, with the same metrics on both.

Mari metrics from the controller. --mari-metrics-output DIR makes the edge adapter write the same run_* folder of PDR, latency and join CSVs that mari-edge writes. --mari-probe-interval S sends metrics probes to every robot (0, the default, sends none). Before this, getting link metrics during a controller run meant running mari-edge separately, which cannot share the gateway's serial port. Both options apply to serial gateways and to the DotBot simulator. The cloud adapter is unchanged apart from sharing the event handler, which is now factored out of the two marilib adapters.

Simulated mari robots run on marilib's network simulator. The simulator's own MariNetworkSimulator was a fixed 102-slot timing model with a per-frame PDR draw. Robots in mari mode now become nodes of a marilib.sim.Network, and a MarilibEdge reads the simulated gateway's UART exactly as it reads a real one. So joins, the schedule, the downlink queue and its limits, and the metrics probes all behave as the firmware does. Commands to mari robots go through mari, while other robots keep the direct path. Probes are answered by the simulated net core and never reach the robot app, as on hardware.

World file changes (breaking, under the beta policy):

  • [network] drops slot_duration_ms and mqtt_latency_ms. The slotframe now comes from the mari schedule, and the network adds no latency of its own.
  • [network] gains schedule (a mari schedule name; when left out, the smallest one that fits the mari robots) and seed.
  • Each robot can set its own uplink_pdr / downlink_pdr, overriding the network-wide values.

Depends on DotBots/mari#179 (marilib.sim), which no marilib release ships yet. Until it does, pyproject.toml takes marilib-pkg from that PR's branch at a fixed commit, so CI can run. That pin is temporary: it must be replaced by a version pin on the marilib release before this merges, which is why this PR stays a draft.

Validation

  • The affected tests pass locally against the mari PR branch (adapter, controller app, simulator and scenarios: 119 tests).
  • On the bench, the controller ran 5 robots through a serial gateway with --mari-metrics-output, and wrote per-robot PDR and latency throughout the runs.
  • In the simulator, the same experiment ran at 5 and 100 robots with collisions on and a link PDR sweep.
File + -
dotbot/adapter.py +119 -39
dotbot/dotbot_simulator.py +99 -80
dotbot/tests/test_dotbot_simulator.py +117 -51
dotbot/tests/test_scenarios.py +62 -2
dotbot/controller_app.py +27 -0
doc/conf.py, pyproject.toml and 7 other small files: controller.py, simulator_init_state.toml (both copies), tests/scenario_harness.py, tests/test_adapter.py, tests/test_controller_app.py, utils/perf/bench_controller.py +74 -22
Total, 14 files +498 -194

Needs a marilib that ships marilib.sim, which no release does yet. World
files lose slot_duration_ms and mqtt_latency_ms: both are now ignored,
and the slotframe comes from the mari schedule instead.

AI-assisted: Claude Opus 5.5
@codecov

codecov Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.69751% with 43 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.17%. Comparing base (6805e0a) to head (c37ecc2).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
dotbot/tests/test_scenarios.py 9.37% 29 Missing ⚠️
dotbot/adapter.py 85.29% 10 Missing ⚠️
dotbot/tests/scenario_harness.py 40.00% 3 Missing ⚠️
dotbot/tests/test_dotbot_simulator.py 98.78% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #336      +/-   ##
==========================================
- Coverage   88.17%   88.17%   -0.01%     
==========================================
  Files         227      227              
  Lines       36028    36200     +172     
  Branches     2323     2324       +1     
==========================================
+ Hits        31769    31919     +150     
- Misses       4255     4277      +22     
  Partials        4        4              
Flag Coverage Δ
console 81.99% <ø> (ø)
python 91.08% <84.69%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
dotbot/controller.py 92.21% <100.00%> (+0.02%) ⬆️
dotbot/controller_app.py 93.93% <100.00%> (+0.09%) ⬆️
dotbot/dotbot_simulator.py 86.86% <100.00%> (+0.50%) ⬆️
dotbot/tests/test_adapter.py 100.00% <100.00%> (ø)
dotbot/tests/test_controller_app.py 100.00% <100.00%> (ø)
dotbot/tests/test_dotbot_simulator.py 99.74% <98.78%> (-0.26%) ⬇️
dotbot/tests/scenario_harness.py 36.19% <40.00%> (-0.35%) ⬇️
dotbot/adapter.py 90.90% <85.29%> (+4.05%) ⬆️
dotbot/tests/test_scenarios.py 13.68% <9.37%> (-0.48%) ⬇️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Temporary: no marilib release ships marilib.sim yet. Replace this with
a version pin once the mari simulator PR is merged and released.

AI-assisted: Claude Opus 5.5

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant