Skip to content

armgit / moss

Public Imported from GitHub
0

MOSS: a small, mostly 3D-printed litter-picking rover. Cleaner streets, one maker at a time.

Python

lidar odometry bench: clean exit (section F clouds released before interpreter exit); cockpit doc: /scan.json camera fields

metroxb5cec82636cd
diff --git a/benches/bench_lidar_odometry_cold.py b/benches/bench_lidar_odometry_cold.py
index 0a6d957..4f5b45f 100644
--- a/benches/bench_lidar_odometry_cold.py
+++ b/benches/bench_lidar_odometry_cold.py
@@ -361,6 +361,10 @@ for m in REAL:
sink = getattr(m, name)
if isinstance(sink, Sink):
sink.msgs.clear()
+ m._pending_cam_pts = None
+# the module-level views of section E (cloud_xyz output and its tag) keep Open3D buffers alive too
+for _name in ("xyz", "tag", "cam_pt", "depth"):
+ globals().pop(_name, None)
gc.collect()
print()
@@ -395,4 +399,16 @@ finally:
print(f"{OK} OK, {KO} KO")
print("TEST PASSED" if KO == 0 else "TEST FAILED")
+# section F built its own module after the clean-up above: drop its clouds too, or
+# Open3D reports them as leaked at interpreter exit and the exit status turns to 1
+for _m in list(REAL) + [v for k, v in list(globals().items()) if k.startswith("o") and hasattr(v, "camera_floor")]:
+ for _name in ("odom", "lidar", "tf", "camera_floor"):
+ _sink = getattr(_m, _name, None)
+ if isinstance(_sink, Sink):
+ _sink.msgs.clear()
+ if hasattr(_m, "_pending_cam_pts"):
+ _m._pending_cam_pts = None
+for _name in ("ring6", "o6", "kiss6"):
+ globals().pop(_name, None)
+gc.collect()
sys.exit(1 if KO else 0)
diff --git a/docs/cockpit.md b/docs/cockpit.md
index fc343b3..d33b985 100644
--- a/docs/cockpit.md
+++ b/docs/cockpit.md
@@ -220,6 +220,10 @@ always allowed. Commands that publish on the bus need the stack on LCM
Endpoints, for anything else that wants the data: `/state.json`, `/map.png`,
`/map_meta`, `/scan.json`, `/path.json`, `/log.json`, `/preflight.json`,
`/launch.json`, `/camera.mjpg` (`?cam=nose`, the default, or `?cam=wrist`), and
+
+`/scan.json` splits the latest `lidar` cloud by height: `points` (and `n`) are the lidar returns, at
+the profile's lidar height; `camera` (and `camera_n`) are the depth camera's obstacle points, at
+their true height, which the page draws in amber. The raw `/pointcloud` fallback has no `camera` key.
`POST /cmd/{explore,goal,stop,episode,stack}`.
`tools/moss_cockpit.py --demo` serves synthetic data for working on the page
without a robot.