Skip to content

gomath: fix negative pitch singularities in RPY and ZYX conversion - #4623

Open
Rimas2200 wants to merge 1 commit into
LinuxCNC:2.9from
Rimas2200:fix/gomath-euler-singularities
Open

Rimas2200 wants to merge 1 commit into
LinuxCNC:2.9from
Rimas2200:fix/gomath-euler-singularities

Conversation

@Rimas2200

Copy link
Copy Markdown

Fixes #389.

Both matrix-to-Euler conversions checked for +pi/2 twice, leaving the negative-pitch branch unreachable. That branch also used m->y.z to recover roll, although this element is zero at pitch = -pi/2.

Changes

  • Fix the negative-pitch check in go_mat_rpy_convert() and go_mat_zyx_convert().
  • Recover roll using -atan2(m->y.x, m->y.y), keeping the existing convention of yaw = 0 at the singularity.
  • Add tests for both poles, rotations inside and outside the singularity tolerance, ordinary rotations, and quaternion conversions with q and -q.
  • Check orientation using independent matrix multiplication.

Testing

  • uspace build and pycheck passed (make -O -j4 default pycheck V=1).
  • tests/posemath/gomath-euler-singularities passed.
  • The targeted conversions also passed with float and long double.

@grandixximo

Copy link
Copy Markdown
Contributor

Pointing at 2.9, again we might want it on master first @andypugh @BsAtHome ?

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.

2 participants