Skip to content

Robot mode v3: parent-relative joints, multi-mesh links, wizard rebuild - #1

Merged
Aryan01b merged 16 commits into
mainfrom
feat/robot-mode-v3
Jul 3, 2026
Merged

Robot mode v3: parent-relative joints, multi-mesh links, wizard rebuild#1
Aryan01b merged 16 commits into
mainfrom
feat/robot-mode-v3

Conversation

@Aryan01b

@Aryan01b Aryan01b commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Summary

  • Rebuilds Robot mode's Create wizard Links step: manual mesh-picker +
    drag-to-reparent hierarchy tree (LinkTreeView), replacing the old
    flat auto-seeded list.
  • Fixes the exporter's joint-origin math to be parent-relative
    instead of always root-relative, and detects the root link by tree
    structure instead of list position — both were silently wrong for any
    tree deeper than 2 levels or after a re-root.
  • Unions every mesh component and mass/inertia a user assigns to a
    link (previously only the first was used, the rest silently dropped).
  • Adds a Matrix3-parameterized InertialAggregator.Combine overload so
    the exporter never has to construct a Quaternion — deliberately
    avoiding new coordinate-conversion code, a bug category that's hit this
    codebase twice before.
  • UI: marks which mesh component is "primary" (defines a link's frame)
    in the wizard, and clicking a link in the hierarchy now highlights its
    actual mesh in the 3D viewport and Mesh box (previously only updated a
    text label).

Built via subagent-driven-development against a written spec/plan (see
docs/superpowers/specs/2026-07-02-robot-joint-relative-pose-design.md
and the matching plan doc) — each piece independently implemented,
spec-reviewed, and code-reviewed, plus a final holistic review across the
combined diff.

Test plan

  • 481 unit tests green (dotnet test Test/SW2GZ.Writers.Test.csproj -c Release)
  • Add-in builds clean (SW2GZ.csproj)
  • Live-tested in SolidWorks on FULL_ARM.SLDASM: 3-level chain
    (grandchild joint relative to its real non-root parent, not root)
    and a multi-mesh link (both parts positioned correctly) — confirmed
    working
  • Live-verify the mesh-highlight-on-tree-click fix (landed after the
    above test round, not yet re-confirmed in SW)

Aryan01b added 16 commits July 1, 2026 06:37
Catalogs every SW COM API member the codebase calls (12 categories,
active vs legacy-pipeline flagged) with file provenance and usage
context; wires it into CLAUDE.md as required reading before new SW
COM calls.
Adds a working Create Robot PMP (Links step seeded from top-level
components, all Fixed to the first/base link) and a matching
Sw2gzRobotExporter that writes a real URDF + meshes, wired into both
Export and Preview.

Fixes a real, pre-existing bug found along the way: Component2.Transform2's
3x3 rotation block is column-major, not row-major as every call site
assumed (verified against Component2.GetBox ground truth). This silently
inverted rotation for any non-identity component in SolidWorksMeshTessellator
and SolidWorksAssemblyWalker (used by World/Asset export too, not just
Robot) -- fixed in both.

Each link's mesh is un-baked into its own native part-local frame using a
new IComponentPoses/SolidWorksComponentPoses (exact per-component rotation
+ translation, not an AABB approximation), so joint origin/rpy carry the
real relative pose between parent and child instead of identity, while
joint type stays hardcoded Fixed -- a mate-driven type/axis/limit detector
was attempted and reverted after live testing showed it misclassifying
joints; see memory robot-mode-dev for the postmortem.

464 -> 470 tests green (net of the reverted detector's own tests).
Parent-relative joint origin (currently always root-relative), tree-based
root detection, multi-mesh union per link, InertialAggregator Matrix3
overload to avoid new quaternion-conversion code. Approved via brainstorming.
Add Matrix3-parameterized twins of InertialAggregator.Combine to allow
callers working entirely in Matrix3/Vector3 (e.g. Sw2gzRobotExporter) to
avoid constructing a Quaternion just to aggregate inertia. Both overloads
share CombineCore (same algorithm, proven direction Quaternion->Matrix3 only).

Refactored CombineCore to de-duplicate inertia aggregation logic:
- Combine(IReadOnlyList<(Props, Pose)>) converts pose to Matrix3, delegates
- Combine(IReadOnlyList<(Props, Matrix3, Vector3)>) direct Matrix3 path
- Combine(parts, anchorR, anchorT) rebase overload for link-local frame

475 tests green; added 6 new InertialAggregatorMatrixTests verifying
byte-identical results for identity/non-identity rotations, null/empty
handling, and anchor-based rebasing.
…parent-relative behavior

Header still described the pre-Tasks-2-4 flat/single-component behavior
(root-relative joints, first-component-only mesh). Update to describe
parent-relative joint origin via LinkHierarchy.Roots, multi-component
mesh/mass union in a shared reference frame, and the base_link mass/mesh
identity-convention asymmetry.
…ve-tested working

3-level chain (grandchild joint relative to real parent, not root) and
multi-mesh link (both parts positioned correctly) confirmed working in
SolidWorks on FULL_ARM.SLDASM. 481 tests green, both projects build clean.
Selecting a link in the tree only updated a text label; the Mesh box and
3D viewport never reflected the pick, staying empty regardless of tree
selection. Reuses the legacy CommonSwOperations.SelectComponents helper
(its own doc comment already described this exact use case, just never
wired into the current wizard) to select the link's ComponentIds under
the same mark the Mesh box listens to.
@Aryan01b
Aryan01b merged commit 89b454b into main Jul 3, 2026
2 of 4 checks passed
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