MOSS: a small, mostly 3D-printed litter-picking rover. Cleaner streets, one maker at a time.
Python
base adapter: full-duty pulses (MOSS_PULSE_MS, 500 ms, ramp 1 1 while pulsing): a percent becomes a duty of full-power slices, the way MOSS's tracks can be steered; tools/moss-pulse-test.sh presets; probe and docs follow
metroxdc0b00893de7
diff --git a/benches/bench_moss_adapter_cold.py b/benches/bench_moss_adapter_cold.pyindex 68564b5..3b8029b 100644--- a/benches/bench_moss_adapter_cold.py+++ b/benches/bench_moss_adapter_cold.py@@ -48,6 +48,7 @@ def settle(s=0.06):# ── 0. gamepad scale: full stick = the base's limit, not the generic 0.6 m/s ──+os.environ["MOSS_PULSE_MS"] = "0" # sections 0-12: the plain mapping and keepalive; pulsing has its own sectionprint("0. teleop_speeds / teleop_envelope (track 0.30 m, 0.45 m/s at 100 %, turn gain 2)")os.environ.pop("MOSS_TURN_GAIN", None)G100 = MossGeometry(track_m=0.30, mps_at_limit=0.45, max_pct=100, min_pct=0) # floor off: the mapping itself@@ -419,6 +420,56 @@ for _name in ("moss_adapter.py", "moss_mock.py"):check(_hits == [], f"{_name}: no dated journal comment (day/month, clock stamp, ISO date): hits {_hits}")print()++# ── 13. full-duty pulses: a percent becomes a duty of 100 % slices ─────+print("13. pulse_tracks + the adapter pulsing on the fake (MOSS_PULSE_MS=500 -> 5 slices of 100 ms)")+from moss_dimos.moss_adapter import pulse_tracks, pulse_ms, PULSE_RAMP # noqa: E402+check([pulse_tracks((100, 100), k, 5) for k in range(5)] == [(100, 100)] * 5, "100 % -> on every slice")+check([pulse_tracks((20, 20), k, 5) for k in range(5)] == [(100, 100), (0, 0), (0, 0), (0, 0), (0, 0)], "20 % -> one slice of 100 % then four off")+check([pulse_tracks((50, -50), k, 5) for k in range(5)] == [(100, -100)] * 3 + [(0, 0)] * 2, "50 % -> three slices on (ceil of 2.5), sign kept per track")+check([pulse_tracks((1, 0), k, 5) for k in range(5)] == [(100, 0), (0, 0), (0, 0), (0, 0), (0, 0)], "1 % -> still one slice on; a 0 track stays off")+check(pulse_tracks((0, 0), 3, 5) == (0, 0), "(0, 0) -> (0, 0): a stop is never pulsed")+check(pulse_tracks((60, 40), 7, 5) == (100, 0), "tick 7 of a 5-slice period = slice 2: 60 % on (3 slices), 40 % off (2 slices)")+check(pulse_tracks((30, 30), 2, 0) == (30, 30), "n_ticks 0 -> pass-through (pulsing off)")+check(pulse_tracks((80, 80), 0, 5, full=25) == (25, 25), "full = the geometry's ceiling (25 here)")+os.environ["MOSS_PULSE_MS"] = "500"+check(pulse_ms() == 500, "MOSS_PULSE_MS=500 -> 500")+os.environ["MOSS_PULSE_MS"] = "9000"+check(pulse_ms() == 2000, "MOSS_PULSE_MS above the cap -> 2000")+os.environ.pop("MOSS_PULSE_MS", None)+check(pulse_ms() == 500, "MOSS_PULSE_MS unset -> 500 (the MOSS default: pulsing on)")+os.environ["MOSS_PULSE_MS"] = "500"+os.environ.pop("MOSS_RAMP_MS", None)+fw7 = FakeMossFirmware()+f7 = lambda: fw7 # noqa: E731+f7.is_mock = True+pa = MossBaseAdapter(dof=3, port_factory=f7, geometry=MossGeometry(track_m=0.30, mps_at_limit=0.15, max_pct=100))+check(pa._pulse_n == 5 and pa._map_geometry.min_pct == 0, f"adapter: 5 slices, mapping floor off while pulsing ({pa._pulse_n}, {pa._map_geometry.min_pct})")+check(pa.connect() and pa._ramp == PULSE_RAMP, f"connect picks 'ramp {PULSE_RAMP}' when MOSS_RAMP_MS is unset (sent on a real board, not on the fake): {pa._ramp!r}")+check(pa.write_enable(True), "armed")+n0 = len(fw7.commands)+check(pa.write_velocities([0.03, 0.0, 0.0]), "vx 0.03 m/s (20 %) accepted")+settle(0.62)+pa.write_stop()+drives = [c for c in fw7.commands[n0:] if c.startswith("drive")]+on = sum(1 for c in drives if c == "drive 100 100")+off = sum(1 for c in drives if c == "drive 0 0")+check(on >= 1 and off >= 3 and on + off == len(drives) and set(drives) <= {"drive 100 100", "drive 0 0"},+ f"on the wire: full-duty slices and off slices only, 20 % = {on} on / {off} off over {len(drives)} ticks: {drives[:8]}")+check(pa._want == (0, 0) and fw7.mode == OFF, "stop clears the duty and the fake is OFF")+check(pa.write_velocities([0.15, 0.0, 0.0]) and fw7.commands[-1] == "drive 100 100", "100 % -> every slice on (first sent now)")+pa.write_stop()+pa.disconnect()+os.environ["MOSS_PULSE_MS"] = "0"+fw8 = FakeMossFirmware()+f8 = lambda: fw8 # noqa: E731+f8.is_mock = True+pb = MossBaseAdapter(dof=3, port_factory=f8, geometry=MossGeometry(track_m=0.30, mps_at_limit=0.15, max_pct=100))+check(pb._pulse_n == 0 and pb._map_geometry.min_pct == 100, "MOSS_PULSE_MS=0 -> no pulsing, the 100 % floor applies instead")+check(pb.connect() and not any(c.startswith("ramp") for c in fw8.commands), "...and no ramp line without MOSS_RAMP_MS")+pb.disconnect()+os.environ.pop("MOSS_PULSE_MS", None)+print(f"{OK} OK, {KO} KO")print("TEST PASSED" if KO == 0 else "TEST FAILED")sys.exit(1 if KO else 0)diff --git a/benches/bench_moss_floor_probe_cold.py b/benches/bench_moss_floor_probe_cold.pyindex ab09aa8..0b0342f 100644--- a/benches/bench_moss_floor_probe_cold.py+++ b/benches/bench_moss_floor_probe_cold.py@@ -15,6 +15,7 @@ from pathlib import PathROOT = Path(__file__).resolve().parent.parentsys.path.insert(0, str(ROOT))+os.environ["MOSS_PULSE_MS"] = "0" # this bench measures a FLOOR: the adapter must send the percent itself, not full-duty slicesfrom moss_dimos import moss_mock # noqa: E402from moss_dimos.moss_adapter import MossBaseAdapter, MossGeometry # noqa: E402diff --git a/benches/bench_moss_fly_gates_cold.py b/benches/bench_moss_fly_gates_cold.pyindex c6f7519..99189ac 100644--- a/benches/bench_moss_fly_gates_cold.py+++ b/benches/bench_moss_fly_gates_cold.py@@ -380,7 +380,7 @@ check("one launch: --rerun-open none --nerf-speed 0.5 run moss-dimos.moss-nav --env_l = run_l[0].split("| ENV ", 1)[1] if run_l and "| ENV " in run_l[0] else ""for want in (f"MOSS_PORT={qtpy}", f"MOSS_LIDAR_PORT={c1}", "DIMOS_TRANSPORT=lcm","TRANSPORT=lcm", "GLIBC_TUNABLES=glibc.rtld.optional_static_tls=4194304", "MOSS_MAX_PCT=100",- "MOSS_RAMP_MS=5 5", "MOSS_RECORD=1", "MOSS_CAMERA=1", f"MOSS_STATE_DIR={case / 'state'}"):+ "MOSS_RAMP_MS=1 1", "MOSS_RECORD=1", "MOSS_CAMERA=1", f"MOSS_STATE_DIR={case / 'state'}"):check(f"stack env: {want.split('=')[0]}={want.split('=', 1)[1][-40:]}",re.search(r"(^| )" + re.escape(want) + r"( |$)", env_l) is not None, env_l[-120:])check("the launcher does not export ROBOT_PROFILE (MOSS is the only profile)",diff --git a/docs/base.md b/docs/base.mdindex 1db6cc9..fe46e37 100644--- a/docs/base.md+++ b/docs/base.md@@ -25,8 +25,8 @@ limit), so the stick stays proportional across its travel. With the defaultbeyond it; a gain of 1 only ever stops it. Releasing R1 sends 0.5 s of zeros,then silence (`MOSS_BRAKE_S`, 0 to 1.0 s). Unloaded, the motors start between5 % and 15 % duty; on the floor they only turn at full duty, so the base-adapter raises every non-zero command to 100 % (`MOSS_MIN_PCT`, see-[cockpit.md](cockpit.md)).+adapter delivers every non-zero command as full-duty pulses (`MOSS_PULSE_MS`,+see [cockpit.md](cockpit.md)).This is the dimOS path. The bench tool in `moss_pi/` drives the same firmwarewithout dimOS and reads raw SDL button 4 as its deadman: L1 on an Xbox-layout@@ -86,7 +86,7 @@ Until `MOSS_TICKS_PER_M` is set, `read_odometry()` returns `None` andrather than a pose made of guesses. Set it and both come from the encoders.The other base knobs: `MOSS_MAX_PCT` (percent ceiling, 100 by default, never-above the firmware's 100), `MOSS_MIN_PCT` (static-friction floor, 100 by default, 0 = off),+above the firmware's 100), `MOSS_PULSE_MS` (full-duty pulse period, 500 by default, 0 = off), `MOSS_MIN_PCT` (static-friction floor when pulsing is off, 100 by default),`MOSS_RAMP_MS` (`"UP DOWN"`, sent as `ramp UP DOWN` at connect), `MOSS_PORT`(the serial port; by default the QT Py's `/dev/serial/by-id` path; only a`dimos run` by hand reads it from the shell, `tools/moss-teleop.sh` anddiff --git a/docs/cockpit.md b/docs/cockpit.mdindex afd5254..65531f2 100644--- a/docs/cockpit.md+++ b/docs/cockpit.md@@ -117,21 +117,28 @@ everywhere. The values are PLACEHOLDERS until measured on the robot:| track centre distance | 0.266 m (CAD) | `MOSS_TRACK_M` || nose camera position on the base | 0.156, 0, 0.075 m (CAD) | `MOSS_CAMERA_XYZ_M="0.156 0 0.075"` || nose camera pitch | 0 deg | `MOSS_CAMERA_PITCH_DEG` |-| static-friction floor of the base adapter (percent) | 100 (full duty only) | `MOSS_MIN_PCT` |+| full-duty pulse period of the base adapter (ms, 0 = off) | 500 | `MOSS_PULSE_MS` |+| static-friction floor of the base adapter when pulsing is off (percent) | 100 | `MOSS_MIN_PCT` |The speed knobs are `MOSS_MAX_PCT` (the PWM cap of the base adapter, 100 bydefault) and `MOSS_NERF_SPEED` (the launcher's `--nerf-speed` for the planner,0.5 by default).-`MOSS_MIN_PCT` is the static-friction floor: a non-zero track command below it-is raised to it, sign kept (a command that rounds to zero stays a stop). On-MOSS it is 100 by default: the geared motors behind the MDD3A only turn the-tracks at full duty on the floor, so every non-zero command becomes a full-duty-command (straight, pivot left, pivot right, stop) and the planner's slowest-pivot (0.2 rad/s, about 6 % PWM on its own) moves the rover instead of leaving-it to log `Robot is stuck. Replanning.` until the goal times out. A base whose-tracks turn below full duty lowers it: `MOSS_MIN_PCT=<percent>` on the launch-line, measured with `tools/moss_floor_probe.py --go` (stack down).+The tracks of MOSS only turn at full duty on the floor (the geared motors+behind the MDD3A), so the base adapter delivers every non-zero command as+full-duty PULSES: a percent becomes a duty over a period of `MOSS_PULSE_MS`+(500 by default, five slices of 100 ms): 40 % = two slices at full power then+three off, 100 % = always on, any non-zero command = at least one slice. The+planner's slowest commands move the rover, and a turn is still a turn. The+firmware ramp follows: while pulsing the launcher defaults `MOSS_RAMP_MS` to+`1 1` (a slice reaches full duty in 100 ms); a slower fall (`"1 5"`) releases+instead of braking between slices, a longer period (`1000`) makes one cycle per+second. `tools/moss-pulse-test.sh sec|moyen|doux` drives three bursts with a+preset so the profile can be seen on the floor, and prints the two variables to+put on the launch line. `MOSS_PULSE_MS=0` turns pulsing off; then+`MOSS_MIN_PCT` (100 by default) raises every non-zero command to the floor+instead, and `tools/moss_floor_probe.py --go` measures a floor for a base whose+tracks turn below full duty.The lidar's floor projection is `base_link`, the rover's rotation centre: mountthe C1 there, or the footprint and the pivot clearance are off by its offset.diff --git a/moss_dimos/moss_adapter.py b/moss_dimos/moss_adapter.pyindex 8f37eea..ab96929 100644--- a/moss_dimos/moss_adapter.py+++ b/moss_dimos/moss_adapter.py@@ -63,7 +63,9 @@ Calibration (env, all optional):MOSS_MIN_PCT static-friction floor in percent (0 = off, default 100: the tracks only turn at full duty): a non-zero track command below it is raised to it, sign keptMOSS_TICKS_PER_M encoder ticks per metre of track travel, measuredMOSS_TURN_GAIN turn authority vs forward speed (teleop_speeds), 0.5..4, default 2- MOSS_RAMP_MS "UP DOWN" sent as 'ramp UP DOWN' after connect+ MOSS_RAMP_MS "UP DOWN" sent as 'ramp UP DOWN' after connect (while pulsing, unset = "1 1")+ MOSS_PULSE_MS period of the full-duty time slicing (default 500, 0 = off): a percent becomes a duty of+ full-power slices over the period (pulse_tracks), the way MOSS's tracks can be steeredMOSS_MOCK_BUS any value but 0/false/no/off: drive the fake firmware (no motors)"""from __future__ import annotations@@ -74,7 +76,7 @@ import mathimport osimport threadingimport time-from dataclasses import dataclass+from dataclasses import dataclass, replacefrom moss_dimos import robot_profile@@ -98,6 +100,36 @@ REPLY_TIMEOUT_S = 0.150 # the firmware answers within a loop tick (ms)CONNECT_PROBE_S = 1.000 # the first "status" of a process: reader thread start + first parse on a Jetson take longer than a reply tickTELEMETRY_FRESH_S = 1.0 # mode read from telemetry older than this = unknownMOCK_BUS_ENV = "MOSS_MOCK_BUS"+PULSE_MS_DEFAULT = 500 # MOSS_PULSE_MS: period of the full-duty time slicing, 0 = off (then MOSS_MIN_PCT applies)+PULSE_MS_MAX = 2000+PULSE_RAMP = "1 1" # firmware ramp while pulsing: 1 ms per %, so a 100 ms slice reaches full duty+++def pulse_ms() -> int:+ """MOSS_PULSE_MS clamped to 0..PULSE_MS_MAX; 0 = no pulsing."""+ return max(0, min(PULSE_MS_MAX, int(_env_float("MOSS_PULSE_MS", PULSE_MS_DEFAULT))))+++def pulse_tracks(want: tuple[int, int], tick: int, n_ticks: int, full: int = 100) -> tuple[int, int]:+ """Time-slice a (left, right) percent pair into full-duty pulses.++ The tracks of MOSS only turn at full duty (the geared motors behind the+ MDD3A), so a percent is delivered as a DUTY over a period of n_ticks+ keepalive ticks: a track at p % is ON (+-full) for ceil(|p| * n / 100)+ ticks from the start of the period and OFF (0) for the rest. Any non-zero+ p is on for at least one tick; |p| >= 100 is always on; 0 is always off.+ Both tracks share the period, so a straight command pulses both together."""+ if n_ticks <= 0:+ return want+ k = tick % n_ticks+ out = []+ for p in want:+ if p == 0:+ out.append(0)+ continue+ on = math.ceil(min(100, abs(p)) * n_ticks / 100 - 1e-9)+ out.append((full if p > 0 else -full) if k < on else 0)+ return out[0], out[1]MODE_OFF, MODE_READY, MODE_DRIVE, MODE_TEST = 0, 1, 2, 3@@ -259,10 +291,17 @@ class MossBaseAdapter:self._telemetry_t: float | None = Noneself._connected = Falseself._enabled = False- self._target = (0, 0)+ self._target = (0, 0) # the last pair sent to the firmware (a pulse value when pulsing)+ self._want = (0, 0) # the last pair asked by the commander (the duty when pulsing)self._target_twist = (0.0, 0.0, 0.0)self._target_t = 0.0self._stopped_for_stale = True+ # full-duty time slicing: n keepalive ticks per period, 0 = off (floor mode)+ self._pulse_n = int(round(pulse_ms() / 1000.0 / KEEPALIVE_S)) if pulse_ms() > 0 else 0+ self._ramp = "" # the ramp sent at connect ("" = the firmware default)+ self._tick = 0+ # the mapping geometry: when pulsing, the static-friction floor is the pulse itself+ self._map_geometry = replace(self._geometry, min_pct=0) if self._pulse_n else self._geometryself._last_logged = Noneself._reader = Noneself._keepalive = None@@ -352,6 +391,12 @@ class MossBaseAdapter:name="moss-keepalive", daemon=True)self._keepalive.start()ramp = os.environ.get("MOSS_RAMP_MS", "").strip() # "10 5" = ms per % up / down+ if self._pulse_n and not ramp:+ ramp = PULSE_RAMP # a slice must reach full duty inside a keepalive tick+ if self._pulse_n:+ _log().info(f"MOSS base: full-duty pulses, period {self._pulse_n * KEEPALIVE_S * 1000:.0f} ms "+ f"({self._pulse_n} slices of {KEEPALIVE_S * 1000:.0f} ms), ramp {ramp} ms per %")+ self._ramp = rampif ramp and not self._mock:if self._send(f"ramp {ramp}"):_log().info(f"MOSS base: firmware ramp set to {ramp} ms per % (rise fall)")@@ -490,19 +535,27 @@ class MossBaseAdapter:vx, vy, wz = float(vx), float(vy), float(wz)except Exception:return False- left, right = twist_to_tracks(vx, wz, self._geometry)- if (left, right) != (0, 0) and not self._enabled:+ want = twist_to_tracks(vx, wz, self._map_geometry)+ if want != (0, 0) and not self._enabled:return False+ left, right = self._slice(want)ok = self._drive(left, right)if ok:+ self._want = wantself._target = (left, right)self._target_twist = (vx, 0.0, wz)self._target_t = time.monotonic()- self._stopped_for_stale = (left, right) == (0, 0)+ self._stopped_for_stale = want == (0, 0)self._velocity = self._velocity if self._geometry.ticks_per_m else (vx, 0.0, wz)- self._log_cmd((vx, vy, wz), (left, right))+ self._log_cmd((vx, vy, wz), want)return ok+ def _slice(self, want: tuple[int, int]) -> tuple[int, int]:+ """The pair to send now: the pulse value of this tick when pulsing, else the pair itself."""+ if not self._pulse_n:+ return want+ return pulse_tracks(want, self._tick, self._pulse_n, int(self._geometry.max_pct))+def _drive(self, left: int, right: int) -> bool:"""Send 'drive L R'; on 'ERR not_armed' (arm expiry, invalid line,the firmware's own deadman) re-arm and retry ONCE. Never pre-arm@@ -528,6 +581,7 @@ class MossBaseAdapter:ok = self._send("stop")if ok:self._target = (0, 0)+ self._want = (0, 0)self._target_twist = (0.0, 0.0, 0.0)self._target_t = time.monotonic()self._stopped_for_stale = True@@ -542,6 +596,7 @@ class MossBaseAdapter:while not self._stop_threads.is_set():time.sleep(KEEPALIVE_S)with self._lock:+ self._tick += 1if not self._connected or self._stopped_for_stale:continueage = time.monotonic() - self._target_t@@ -549,12 +604,16 @@ class MossBaseAdapter:_log().warning(f"MOSS base: no twist for {age:.2f}s - stop (deadman)")self._send("stop")self._target = (0, 0)+ self._want = (0, 0)self._target_twist = (0.0, 0.0, 0.0)self._stopped_for_stale = Trueif not self._geometry.ticks_per_m:self._velocity = (0.0, 0.0, 0.0)continue- if self._target != (0, 0):+ if self._want != (0, 0):+ # pulsing: the slice of this tick, 'drive 0 0' included (an OFF slice+ # keeps the firmware armed and its 300 ms deadman fed)+ self._target = self._slice(self._want)self._send(f"drive {self._target[0]} {self._target[1]}")# what the firmware actually applies, and the battery# voltage under load: one line per 2 sdiff --git a/tools/moss-fly.sh b/tools/moss-fly.shindex 80e4835..ccc1c07 100755--- a/tools/moss-fly.sh+++ b/tools/moss-fly.sh@@ -62,7 +62,9 @@ export GLIBC_TUNABLES=glibc.rtld.optional_static_tls=4194304 # larger static TBUS="${DIMOS_TRANSPORT:-${TRANSPORT:-lcm}}"export DIMOS_TRANSPORT="$BUS" TRANSPORT="$BUS"export MOSS_MAX_PCT="${MOSS_MAX_PCT:-100}" # firmware limit 100; lower it for a cautious lap-export MOSS_RAMP_MS="${MOSS_RAMP_MS:-5 5}" # firmware ramp, ms per % up/down+# firmware ramp, ms per % up/down: 1 1 while the base adapter pulses (a 100 ms slice must+# reach full duty, MOSS_PULSE_MS, 500 by default), 5 5 when pulsing is off (MOSS_PULSE_MS=0)+if [ "${MOSS_PULSE_MS:-500}" != "0" ]; then export MOSS_RAMP_MS="${MOSS_RAMP_MS:-1 1}"; else export MOSS_RAMP_MS="${MOSS_RAMP_MS:-5 5}"; fiexport MOSS_STATE_DIR="${MOSS_STATE_DIR:-$HOME/.local/state/moss}"export MOSS_RECORD="${MOSS_RECORD:-1}"export MOSS_CAMERA="${MOSS_CAMERA:-1}"diff --git a/tools/moss-pulse-test.sh b/tools/moss-pulse-test.shnew file mode 100755index 0000000..902ac2c--- /dev/null+++ b/tools/moss-pulse-test.sh@@ -0,0 +1,23 @@+#!/usr/bin/env bash+# Three straight bursts (40, 70, 100 % duty, 1.5 s each, 1 s stop between) with a+# pulse preset, to SEE the motion profile on the floor. Stack down (the tool opens+# the motor board itself), two metres clear ahead.+#+# tools/moss-pulse-test.sh sec # 100 ms slices at full duty, hard brake between (period 500 ms)+# tools/moss-pulse-test.sh moyen # same period, release over 300 ms instead of a hard brake+# tools/moss-pulse-test.sh doux # one cycle per second, release over 500 ms+# tools/moss-pulse-test.sh doux --from 20 --to 100 --step 20 # any floor-probe option after the preset+#+# The preset is two variables; the same two on the launcher give the stack the+# same profile: MOSS_PULSE_MS=<ms> MOSS_RAMP_MS="<rise> <fall>" EXPLORE=1 tools/moss-fly.sh explore+set -u+cd "$(dirname "$0")/.." || exit 1+case "${1:-}" in+ sec) export MOSS_PULSE_MS=500 MOSS_RAMP_MS="1 1" ;;+ moyen) export MOSS_PULSE_MS=500 MOSS_RAMP_MS="1 3" ;;+ doux) export MOSS_PULSE_MS=1000 MOSS_RAMP_MS="1 5" ;;+ *) echo "usage: tools/moss-pulse-test.sh sec|moyen|doux [floor-probe options]"; exit 2 ;;+esac+shift+echo "preset $MOSS_PULSE_MS ms period, ramp $MOSS_RAMP_MS ms per % (rise fall) -> for the stack: MOSS_PULSE_MS=$MOSS_PULSE_MS MOSS_RAMP_MS=\"$MOSS_RAMP_MS\" EXPLORE=1 tools/moss-fly.sh explore"+exec .venv/bin/python tools/moss_floor_probe.py --go --all --from 40 --to 100 --step 30 --hold 1.5 --settle 1.0 --min-ticks 20 "$@"diff --git a/tools/moss_floor_probe.py b/tools/moss_floor_probe.pyindex 8e22687..6356e4b 100755--- a/tools/moss_floor_probe.py+++ b/tools/moss_floor_probe.py@@ -33,7 +33,7 @@ from pathlib import PathROOT = Path(__file__).resolve().parent.parentsys.path.insert(0, str(ROOT))-from moss_dimos.moss_adapter import MossBaseAdapter, MossGeometry # noqa: E402+from moss_dimos.moss_adapter import KEEPALIVE_S, MossBaseAdapter, MossGeometry # noqa: E402STACK_RE = r"[b]in/dimos( [^ ]+)* run( |$)"TELEMETRY_WAIT_S = 3.0@@ -161,6 +161,11 @@ def main(argv=None) -> int:rows = run(adapter, pcts, a.hold, a.settle, a.min_ticks, stop_at_first=not a.all)finally:adapter.disconnect()+ if getattr(adapter, "_pulse_n", 0):+ print(f"pulse mode ({adapter._pulse_n} slices of {KEEPALIVE_S * 1000:.0f} ms, ramp {adapter._ramp or 'firmware default'}): "+ "the percent is a duty of full-power slices, the table above is the ticks per step; "+ "MOSS_MIN_PCT does not apply (MOSS_PULSE_MS=0 to measure a floor instead)")+ return 0 if rows else 1floor = judge(rows, a.min_ticks)if floor is None:print(f"no step up to {pcts[-1] if pcts else '-'} % turned both tracks: raise --to, or check the drive line")