Skip to content

Unify the polished-7R solver tail into refinement.polish_candidates #467

Description

@siddhss5

Problem

Three solvers hand-roll the same polish tail, and it has already started to drift (the #462 completeness invariant -- filter limits after polish, not before -- currently lives in only one of them):

  • seven_r/srs_polished.py (solve)
  • seven_r/spherical_shoulder_polished.py (_polished)
  • seven_r/_swivel_limits.py (resolve_in_limits, approximate path)

Each builds identical _fk/_jac closures around poe_forward_kinematics/kinbody_jacobian, calls lm_refine_batch, keeps rows with res <= atol (and, for two of them, in-limits), then dedup_by_wrap_close. ~20 lines x 3, plus the invariant duplicated.

This sits one layer below postprocess.finalize_solutions (which is Solutions -> limits -> seed-rank -> truncate); the new helper is raw seeds -> polish -> FK-accept -> dedup -> Solutions.

Plan

  1. Extract refinement.polish_candidates(kb, seeds, T, *, accept_fk_atol, dedup_tol, lm_fk_atol, lm_max_iters, limits=None, batched=False, solution_factory=None, max_solutions=None) -> list[Solution]. The completeness invariant (polish first, filter limits second, never pre-filter) is documented and enforced here, once.
  2. Delegate all three paths to it, preserving each caller's exact params (behavior-preserving; validated against the existing green SRS/7R suite). Callers keep only their arm-specific seed generation.
  3. jointlock.seven_r is deliberately out of scope: exact HP per locked-joint sample, no polish, in-sweep filter on exact configs. Its gap (ROBOTERA Star1 7R: respect_limits branch-coverage gap (tier-1 jointlock+HP), raw solver is complete #459) is sampling density, a different fix.

Payoff

Follow-up to #462 / #465.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions