posemath library is incorrect

More
12 Dec 2017 09:05 - 12 Dec 2017 09:07 #102983 by thang
Hi,

I was reading posemath library and getting a problem.Seem, there are some wrong functions in this library.

Example, here is roll-pitch-yall rotation:

and here is function "pmMatRpyConvert" in github.com/LinuxCNC/linuxcnc/blob/master...posemath/_posemath.c :

int pmMatRpyConvert(PmRotationMatrix const * const m, PmRpy * const rpy)
{
rpy->p = atan2(-m->x.z, pmSqrt(pmSq(m->x.x) + pmSq(m->x.y)));

if (fabs(rpy->p - (2 * PM_PI)) < RPY_P_FUZZ) {
rpy->r = atan2(m->y.x, m->y.y);
rpy->p = (2 * PM_PI); /* force it */
rpy->y = 0.0;
} else if (fabs(rpy->p + (2 * PM_PI)) < RPY_P_FUZZ) {
rpy->r = -atan2(m->y.z, m->y.y);
rpy->p = -(2 * PM_PI); /* force it */
rpy->y = 0.0;
} else {
rpy->r = atan2(m->y.z, m->z.z);
rpy->y = atan2(m->x.y, m->x.x);
}

return pmErrno = 0;
}

The condition should be "fabs(rpy->p - (PM_PI/2)) < RPY_P_FUZZ", replaced 2*PM_PI by PM_PI/2
Attachments:
Last edit: 12 Dec 2017 09:07 by thang.

Please Log in or Create an account to join the conversation.

More
13 Dec 2017 14:39 #103080 by andypugh
Can you raise this as an issue on the bug-tracker?
github.com/LinuxCNC/linuxcnc/issues

(You can link to the post here rather than repeat all the equations)

Please Log in or Create an account to join the conversation.

More
16 Dec 2017 03:22 #103154 by thang
Replied by thang on topic posemath library is incorrect
ok, i did

Please Log in or Create an account to join the conversation.

More
16 Dec 2017 11:45 #103165 by PKM
Replied by PKM on topic posemath library is incorrect
Interesting. I can't remember well, but...
In my custom pentapod kinematics I had to create my own functions where pmMatRpyConvert could be used.
So I probably tried using pmMatRpyConvert and it did not work properly.

Please Log in or Create an account to join the conversation.

More
16 Dec 2017 13:13 #103166 by thang
Replied by thang on topic posemath library is incorrect
i think you cant use pmMatRpyConvert function because you installed your custom kinematics out side source tree, installer completed but when you load module it's always say something like " pmMatRpyConvert undefine"

Please Log in or Create an account to join the conversation.

More
16 Dec 2017 18:30 #103173 by PKM
Replied by PKM on topic posemath library is incorrect
I included the kinematics into the source tree, and I successfully use other posemath functions, like pmRpyMatConvert.
But if you use halcompile they won't work.

Please Log in or Create an account to join the conversation.

Time to create page: 0.266 seconds
Powered by Kunena Forum