Skip to content

Use unit screw criteria for twist isunit predicates - #317

Open
kaushikgunasekaren wants to merge 2 commits into
rai-opensource:masterfrom
kaushikgunasekaren:fix-twist-unit-predicate-nov21
Open

kaushikgunasekaren wants to merge 2 commits into
rai-opensource:masterfrom
kaushikgunasekaren:fix-twist-unit-predicate-nov21

Conversation

@kaushikgunasekaren

Copy link
Copy Markdown

Bug

Twist2.isunit and Twist3.isunit test the Euclidean norm of the full twist vector. That is not the unit-screw condition: a rotational screw needs a unit angular component, while a pure translation needs a unit translational component.

For example, Twist3.UnitRevolute([0, 0, 1], [2, 3, 0]).isunit returns false even though the constructor creates a unit screw. Conversely, [0.6, 0, 0, 0.8, 0, 0] is incorrectly accepted because its full vector has unit length despite its angular component having length 0.8. Normalizing an off-origin screw with .unit() also leaves .isunit false.

Change

Use the existing isunittwist2 / isunittwist predicates, keeping the established scalar-versus-sequence result shape. Update the property description to state the same screw criterion used by the constructors, normalization methods and base helpers. No changes to .unit() or velocity/displacement interpretation are included.

Validation

  • 26 focused regression/control cases: 16 fail before the fix; all 26 pass after it.
  • Off-origin revolute and helical screws, negative angular directions, false positives with unit full-vector length, prismatic and zero twists, mixed sequences, empty sequences and .unit().isunit consistency in both 2D and 3D.
  • Full local suite: 592 passed, 3 skipped, 99 subtests passed (21 warnings), versus 566 passed on unchanged master.
  • Changed-source/test Black 23.10.0 and fatal flake8 checks pass. Whole-repository fatal lint has two pre-existing undefined-name findings in tests/test_dualquaternion.py.

AI assistance was used for investigation, implementation and tests. Validation is local Python testing only; no hardware validation is claimed.

This branch has not been deployed

No deployments
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