Robot mode v3: parent-relative joints, multi-mesh links, wizard rebuild - #1
Merged
Conversation
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).
…ployed to last-known-good
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.
…reuse in mass combine
…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.
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.
Summary
drag-to-reparent hierarchy tree (
LinkTreeView), replacing the oldflat auto-seeded list.
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.
link (previously only the first was used, the rest silently dropped).
Matrix3-parameterizedInertialAggregator.Combineoverload sothe exporter never has to construct a
Quaternion— deliberatelyavoiding new coordinate-conversion code, a bug category that's hit this
codebase twice before.
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.mdand the matching plan doc) — each piece independently implemented,
spec-reviewed, and code-reviewed, plus a final holistic review across the
combined diff.
Test plan
dotnet test Test/SW2GZ.Writers.Test.csproj -c Release)SW2GZ.csproj)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
above test round, not yet re-confirmed in SW)