Skip to content

Commit ccea072

Browse files
Michał Fąferekmfaferek93
authored andcommitted
fix(mosaico_integration): address notebook review feedback
- Setup cell: replace the stale git-clone + b3867be pin instructions with `pip install 'mosaicolabs>=0.4.0,<0.5' matplotlib pandas`, matching the Dockerfile + README bump in 4012fdf. - Fleet comparison cell: pick the two sequences that are actually stationary instead of taking `lidar_sequences[0]` and `[1]`. The previous alphabetical selection silently paired robot-01 (noise) with robot-02 (noise under rotation), so the "noise vs drift" comparison promised in the markdown collapsed to noise vs noise. Now we intersect `lidar_sequences` with the stationary result from §6 so the plot compares robot-01 (noise) against robot-03 (drift) as documented.
1 parent 355ceca commit ccea072

1 file changed

Lines changed: 19 additions & 10 deletions

File tree

demos/mosaico_integration/notebooks/mosaico_demo.ipynb

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,10 @@
4343
"- `localhost:18080` - medkit gateway (REST + SSE)\n",
4444
"- `localhost:16726` - mosaicod (Apache Arrow Flight)\n",
4545
"\n",
46-
"The `LaserScanAdapter` we need merged into mosaico-labs/mosaico via PR #368 on 2026-04-13 (commit `b3867be`). The subsequent `mosaicolabs==0.3.2` wheel on PyPI is missing the `futures` subpackage, so until a fixed release ships install from the merged-PR commit directly:\n",
46+
"Install the SDK plus the two plotting deps used below:\n",
4747
"\n",
4848
"```bash\n",
49-
"pip install matplotlib pandas\n",
50-
"git clone https://github.com/mosaico-labs/mosaico.git /tmp/mosaico\n",
51-
"cd /tmp/mosaico && git checkout b3867be\n",
52-
"pip install /tmp/mosaico/mosaico-sdk-py\n",
49+
"pip install 'mosaicolabs>=0.4.0,<0.5' matplotlib pandas\n",
5350
"```\n",
5451
"\n",
5552
"If you skipped installing locally and only have the docker stack, you can still execute the cells inside the bridge container with `docker compose exec bridge python -c '...'`."
@@ -279,7 +276,7 @@
279276
"\n",
280277
"Mosaico's `QueryOntologyCatalog` supports compound expressions with implicit AND, so we can push all six conditions into one server-side query.\n",
281278
"\n",
282-
"In the fleet variant this query is not cosmetic: the fleet injector rotates robot-02 (IMU `drift_rate=0.3 rad/s`) while triggering the same LIDAR noise as robot-01, so robot-02's `angular_velocity.z` sits around 0.3 rad/s. The `between(-0.1, 0.1)` predicate excludes that sequence, leaving only the two stationary LIDAR faults for downstream content comparison (§7). Step 2 doing real work, not just showing the SDK surface."
279+
"In the fleet variant this query is not cosmetic: the fleet injector rotates robot-02 (IMU `drift_rate=0.3 rad/s`) while triggering the same LIDAR noise as robot-01, so robot-02's `angular_velocity.z` sits around 0.3 rad/s. The `between(-0.1, 0.1)` predicate excludes that sequence, leaving only the two stationary LIDAR faults for downstream content comparison (\u00a77). Step 2 doing real work, not just showing the SDK surface."
283280
]
284281
},
285282
{
@@ -325,7 +322,13 @@
325322
"source": [
326323
"from pathlib import Path\n",
327324
"\n",
328-
"if len(lidar_sequences) >= 2:\n",
325+
"# Use the stationary sequences from \u00a76 - the IMU query already excluded robot-02\n",
326+
"# (which was rotating during its fault). The two remaining stationary LIDAR\n",
327+
"# sequences are robot-01 (noise injection) and robot-03 (drift injection).\n",
328+
"stationary_names = {item.sequence.name for item in stationary}\n",
329+
"stationary_lidar = [name for name in lidar_sequences if name in stationary_names]\n",
330+
"\n",
331+
"if len(stationary_lidar) >= 2:\n",
329332
" def _pull_scan_stats(seq_name):\n",
330333
" _sh = client.sequence_handler(seq_name)\n",
331334
" _topic = _sh.get_topic_handler(\"/sensors/scan\")\n",
@@ -342,7 +345,9 @@
342345
" df[\"t_s\"] = (df[\"timestamp_ns\"] - df[\"timestamp_ns\"].iloc[0]) / 1e9\n",
343346
" return df\n",
344347
"\n",
345-
" seq_a, seq_b = lidar_sequences[0], lidar_sequences[1]\n",
348+
" # Sort so robot-01 is consistently on the left, robot-03 on the right.\n",
349+
" stationary_lidar = sorted(stationary_lidar)\n",
350+
" seq_a, seq_b = stationary_lidar[0], stationary_lidar[1]\n",
346351
" df_a = _pull_scan_stats(seq_a)\n",
347352
" df_b = _pull_scan_stats(seq_b)\n",
348353
"\n",
@@ -378,7 +383,11 @@
378383
" plt.show()\n",
379384
" print(f\"Left: {seq_a}\\nRight: {seq_b}\\nSaved to {_out_path}\")\n",
380385
"else:\n",
381-
" print(f\"Only {len(lidar_sequences)} LIDAR_SIM sequence(s). Run the fleet variant for comparison.\")"
386+
" print(\n",
387+
" f\"Only {len(stationary_lidar)} stationary LIDAR_SIM sequence(s) \"\n",
388+
" f\"(of {len(lidar_sequences)} total). Run the fleet variant and inject \"\n",
389+
" f\"faults on robot-01 and robot-03 for the comparison.\"\n",
390+
" )"
382391
],
383392
"metadata": {},
384393
"execution_count": null,
@@ -407,4 +416,4 @@
407416
},
408417
"nbformat": 4,
409418
"nbformat_minor": 4
410-
}
419+
}

0 commit comments

Comments
 (0)