Skip to content

Cwbollinger/state machine declarative clean - #142

Open
cwbollinger wants to merge 10 commits into
mainfrom
cwbollinger/state-machine-declarative-clean
Open

cwbollinger wants to merge 10 commits into
mainfrom
cwbollinger/state-machine-declarative-clean

Conversation

@cwbollinger

Copy link
Copy Markdown
Contributor

No description provided.

@cwbollinger
cwbollinger force-pushed the cwbollinger/state-machine-declarative-clean branch from 74e1104 to c7a2b02 Compare November 19, 2026 06:21
…ded TreadedBase

Move these demos to the GroupManager-based TreadedBase API (from_config, no
t_now, on_base_update) introduced for the tready demos. Not yet tested on
hardware.
…ward.py

Add treadward.cfg.yaml and have the Treadward selector launch treaded_base with
it. That replaces treadward.py, which imports TreadedBaseControl, MobileIOModes
and try_create_base_group (none of which exist any more) and which nothing
else launches, so remove it.

Not yet tested on hardware.
kits/common/state_machine.py: a Controller that runs on a GroupManager thread,
with ControllerState classes. update() returns the next state; receive_inputs()
only records requests, so only the Controller ever transitions. Input loss
enters DisconnectedState, which holds position; an M-stop enters a fault state
that drops the goal and resumes afterwards.

kits/common/config.py: shared config loading and command-line helpers.
Removes the old state_machine_template.py, which this replaces.
Add kits/arms/arm_controller.py (ArmController: gripper handling, hold on
disconnect, fault state) and rewrite the AR, joystick and leader/follower
controllers as states on it. The other kits/arms examples and the Rosie arm
demo load their settings from config files and use the shared helpers.

All arm demos use the same LED colors: magenta while homing, blue when
disconnected, transparent otherwise, set by ArmController from the state. An
invalid AR phone orientation is NaN, so the arm holds position instead of
tracking an identity pose.

The tready arm demos still use the old classes until "Tready demos: use the
demo runner".
The mast and camera run as GroupManagers under a MastController with startup,
teleop, disconnected, fault and exit states. Disconnect holds position, and an
M-stop drops the goal and returns to teleop once released. Mast settings move
to config/pan_tilt_mast.cfg.yaml.

tready_mast_demo still uses the old classes until "Tready demos: use the demo
runner".
@cwbollinger
cwbollinger force-pushed the cwbollinger/state-machine-declarative-clean branch from c7a2b02 to 012fd3c Compare November 19, 2026 06:30
TreadedBase states return the next state from update(), with the controller
and Mobile IO updater built on kits/common/state_machine. The Mobile IO
updater queues its changes for the main thread (one layout/label/status flush
per poll) instead of talking to the phone from the control thread, and the
demo_runner module holds the loop every tready demo shares (find hardware,
start controllers, poll the phone, hand each controller its input or explicit
idle inputs, log, shut down).

The tready demos still use the old API until "Tready demos: use the demo
runner".
The base, arm (AR and joystick), camera mast, sampler, leader/follower and sub
demos take their config files on the command line and run through
demo_runner. Add the configs for the sub, MAPS follower and core sampler
demos; the demo and Treadward selectors launch them with their configs.

The joystick arm parser treats NaN axes (read right after a layout is sent) as
no input.

Remove demo_selector.py: the web-based demo selector replaces it.
Show "Low Battery" below 32 V and "CHARGE NOW!" below 31 V in the Mobile IO
status text, instead of only the voltage. A voltage of 0 (no reading yet)
is not a low battery.
…chine

Drive TreadedBaseController, MastController and the arm controllers against
imitated modules (disconnect holds, M-stop recovery, resume to the interrupted
state, NaN IMU or phone pose), unit-test the common state machine, and check
the Mobile IO parsers, LED colors, low-battery text and demo config targets.
Static checks: only the Controller transitions states, the demos parse on
Python 3.11, and log names and selector targets are valid. Free test Groups
promptly so a later test does not block on them.
@cwbollinger
cwbollinger force-pushed the cwbollinger/state-machine-declarative-clean branch from 012fd3c to 4a59579 Compare November 19, 2026 06:45
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