Repository navigation
Conversation
|
Yes, target master branch. Then, wouldn't it be better to look at consolidating all these routines? There is overlap between gomath and posemath IIRC. |
|
As these routines currently live in libnml and we want to remove that it is probably a good idea to consolidate the math routines and put them into a more appropriate library. |
|
please point to master |
|
@Rimas2200 thanks for tracking this down. Following the consolidation suggestion above, I opened #4676, which moves genserkins, the only user of gomath, onto posemath and removes gomath, so this PR would have no gomath left to change. posemath's pmMatRpyConvert() already takes the -pi/2 branch the way your fix does, so #389 is fixed there for genser; I credited your analysis in that PR. Your ZYX half is still needed, though, in posemath now: pmMatZyxConvert() checks -pi/2 correctly but recovers the roll from m->y.z, which is zero at that pitch, the same mistake you fixed in go_mat_zyx_convert(). Nothing in the tree calls it today, so it is latent. If you want to retarget this PR to that fix, your pole tests would carry over to pmMatRpyConvert() and pmMatZyxConvert(), written as a component loaded after a module that exports them, like tests/kins-jacobian, since tests that compile tree sources break as soon as those sources gain EXPORT_SYMBOL (#4670). |
|
Sure, no problem. I’ll get to it closer to the weekend. I’m currently fighting with some hardware issues on a Delta robot, so I’m a bit tied up 😄 Thanks for the detailed pointers! |
40b3a39 to
e06d24a
Compare
At pitch -pi/2, pmMatZyxConvert() recovers roll from m->y.z, which vanishes at the pole. Use -atan2(m->y.x, m->y.y) to preserve the rotation with yaw set to zero, matching pmMatRpyConvert().
Retarget the remaining ZYX fix to posemath following #4676. Port the regression tests to a component loaded after tpmod, which exports the matrix conversions and their quaternion wrappers. The 322 conversion checks cover both poles, their neighborhoods, ordinary rotations, and both quaternion signs using an independent rotation-matrix oracle.
Validation: uspace build and pycheck passed; tests/posemath/euler-singularities and tests/kins-jacobian passed. The Euler test reproduces the negative-pole ZYX failure with the original formula.