v1: PreciseFlex: split the package into per-concern modules#1100
Merged
Conversation
…s / arm_backend modules Restructure only, no behaviour change. The single 2400-line `precise_flex.py` is split into the per-concern module layout already used by the KX2 backend (`pylabrobot/paa/kx2`): - `config.py` - the `Axis` enum and the resolved `PreciseFlexConfiguration` record - `driver.py` - pure transport: the socket I/O connection and device lifecycle - `kinematics.py` - FK/IK plus the value types it produces/consumes (`PreciseFlexCartesianPose`, `WorkingVolume`, the orientation/wrist literals) - `arm_backend.py` - the capability backend and its controller-reply parsers - `precise_flex.py` - the thin per-model device front-ends `tests/` becomes a package, split per module (`kinematics_tests.py`, `arm_backend_tests.py`). `driver` depends on nothing PreciseFlex-specific; `config` depends only on `kinematics`; there are no import cycles. Public imports via the package `__init__` are unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… errors module `setup()` now logs a single structured summary of the discovered device instead of two separate lines. `_log_configuration_summary` reports five fields - name, connection (`host:port`), firmware (GPL/TCS), this unit's configuration (model, robot type, axes, rail, gripper variant), and the resulting capabilities (reach class, link lengths, modules) - and the driver's separate `connected: port=` line is demoted to DEBUG so exactly one INFO summary fires at setup. Also adds the module docstring `errors.py` was missing, so every module in the package is documented. No public API change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Marks off the three concerns in `kinematics.py` with the package's boxed comment dividers: value types, kinematic parameters, and forward / inverse kinematics. Comments only, no code change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Renames the class, the `work_envelope` property, and the re-export to the standard robotics term for an arm's reachable region. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Splits the single 2400-line
precise_flex.pyinto per-concern modules, matching the layout already used by larger backends in the tree (the Hamilton STAR backend, and the KX2 arm backend in #880): a thin device front-end over a driver / capability-backend / kinematics / config split, with tests as a package.Important for review: the large diff in the first commit is a move, not a rewrite.
precise_flex.pyis split across new files; no logic changed and the public API is identical (everything still imports frompylabrobot.brooks.precise_flex). git renders it as a big delete plus adds because a one-to-four file split cannot be shown as renames. The clearest way to review it is to confirm the public surface is unchanged and that the tests pass.Module map:
config.py- theAxisenum and the resolvedPreciseFlexConfigurationrecorddriver.py- pure transport: the socket I/O connection and device lifecyclekinematics.py- FK/IK and the value types it produces and consumes (PreciseFlexCartesianPose,WorkEnvelope, orientation/wrist literals)arm_backend.py- the capability backend and its controller-reply parsersprecise_flex.py- the thin per-model device front-endserrors.py- the controller reply-code table andPreciseFlexErrortests/- a package, split per module (kinematics_tests.py,arm_backend_tests.py)The dependency graph is acyclic:
kinematicsis the leaf,configdepends only on it,driverdepends on nothing PreciseFlex-specific, andarm_backendand the front-ends sit on top.The second commit is the one behavioural change:
setup()now emits a single structured summary line (name, connection, firmware, configuration, capabilities) instead of two separate INFO lines, and adds the module docstringerrors.pywas missing.No public API change. Existing tests pass; the package is lint, format, and isort clean and adds no new type errors.
🤖 Generated with Claude Code