Repository navigation
fix(hypergraph): build a slider from a prismatic node in to_mechanism - #60
Merged
Merged
Conversation
A slider-crank did not survive Linkage.to_hypergraph() → to_mechanism() (#56), for two reasons. from_sim_linkage tagged only LinearActuator nodes as PRISMATIC and left the output of an RRPDyad (and PPDyad) REVOLUTE. Its guide is a hyperedge over the two line anchors and the slider, which the clique expansion from #55 turns into two more neighbours. Tag those nodes PRISMATIC: the dyad's output is the slider block. compute_mobility then counts it as such and a slider-crank reports 1 DOF instead of 0. to_mechanism built every driven node from its first two solved neighbours as two Links, whatever its joint_type, so the slider became an RRR dyad pinned to a ground node at its initial distance and jammed as soon as the crank turned. A PRISMATIC node is now read the way from_sim_linkage writes it — one edge to its revolute anchor, one hyperedge of three nodes for the line — and becomes a PrismaticJoint with axis and line_point taken from the two line nodes, linked to the anchor alone. It is scheduled once that anchor is solved. The round trip reproduces Linkage.step() to machine precision. Mechanism only holds a slide line fixed to the frame, so a guide on a moving link, a PPDyad-style double slider and a prismatic node without a guide raise NotImplementedError instead of being mis-solved. Closes #56
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.
Closes #56.
A slider-crank did not survive
Linkage.to_hypergraph()→to_mechanism(): it assembled, then jammed as soon as the crank turned.from_sim_linkagetagged onlyLinearActuatornodesPRISMATIC; anRRPDyad(orPPDyad) output stayedREVOLUTE. Its guide is a hyperedge over the two line anchors and the slider, which the clique expansion from #55 turns into two extra neighbours. The dyad's output is now taggedPRISMATIC— it is the slider block — andcompute_mobilityreports 1 DOF for the slider-crank instead of 0.to_mechanismbuilt every driven node from its first two solved neighbours as twoLinks regardless ofjoint_type, so the slider became an RRR dyad pinned to a ground node at its initial distance. APRISMATICnode is now read the wayfrom_sim_linkagewrites it: one edge to its revolute anchor, one 3-node hyperedge for the line. It becomes aPrismaticJointwithaxis/line_pointtaken from the two line nodes and a single link to the anchor, scheduled once that anchor is solved.The round trip reproduces
Linkage.step()to ~1e-15 over a full cycle (the issue's reproducer is now a test).Mechanismonly holds a slide line fixed to the frame, so the cases it cannot represent raiseNotImplementedErrorwith a reason instead of mis-solving: a guide on a moving link, aPPDyad-style double slider, a prismatic node with no guide hyperedge.Not in scope, noted for later:
from_mechanismstill drops the slide line of aPrismaticJoint(it has no joints on the line to hang a hyperedge on), soslider_crank()→from_mechanism→to_mechanismfails as before.LinearActuatordriver node is still built as a revolute crank byto_mechanism.indeterminacy()counts a ground joint that only sits on the ground link as a revolute pair, so it reports −1 for the round-tripped slider-crank;compute_mobilityon the hypergraph is right.