Yes, I would try changing:
Code: Select all
double CP_Rotated_C_x,CP_Rotated_C_y,CP_Rotated_C_z;
double CP_Rotated_AC_x,CP_Rotated_AC_y,CP_Rotated_AC_z;
if (m_MotionParams.TCP_Active)
{
x -= m_MotionParams.TCP_X;
y -= m_MotionParams.TCP_Y;
z -= m_MotionParams.TCP_Z;
// Determine where the commanded XYZ point will be after C rotation
Rotate3(CTableAZeroXCenterpoint, CTableAZeroYCenterpoint, CTableAZeroZZero, x, y, z, 0, 0, -c, &CP_Rotated_C_x, &CP_Rotated_C_y, &CP_Rotated_C_z);
// Determine where the commanded XYZ point will be after A rotation
Rotate3(CTableAZeroXCenterpoint, ASaddleYCenterpoint, ASaddleZCenterpoint, CP_Rotated_C_x, CP_Rotated_C_y, CP_Rotated_C_z, -a, 0, 0, &CP_Rotated_AC_x, &CP_Rotated_AC_y, &CP_Rotated_AC_z);
// Translate XYZ target for AC rotation
x = CP_Rotated_AC_x + m_MotionParams.TCP_X;
y = CP_Rotated_AC_y + m_MotionParams.TCP_Y;
z = CP_Rotated_AC_z + m_MotionParams.TCP_Z;
}
To:
Code: Select all
double CP_Rotated_B_x,CP_Rotated_B_y,CP_Rotated_B_z;
double CP_Rotated_AB_x,CP_Rotated_AB_y,CP_Rotated_AB_z;
if (m_MotionParams.TCP_Active)
{
x -= m_MotionParams.TCP_X;
y -= m_MotionParams.TCP_Y;
z -= m_MotionParams.TCP_Z;
// Determine where the commanded XYZ point will be after B rotation
Rotate3(CTableAZeroXCenterpoint, CTableAZeroYCenterpoint, CTableAZeroZZero, x, y, z, 0, -b, 0, &CP_Rotated_B_x, &CP_Rotated_B_y, &CP_Rotated_B_z);
// Determine where the commanded XYZ point will be after A rotation
Rotate3(CTableAZeroXCenterpoint, ASaddleYCenterpoint, ASaddleZCenterpoint, CP_Rotated_B_x, CP_Rotated_B_y, CP_Rotated_B_z, -a, 0, 0, &CP_Rotated_AB_x, &CP_Rotated_AB_y, &CP_Rotated_AB_z);
// Translate XYZ target for AB rotation
x = CP_Rotated_AB_x + m_MotionParams.TCP_X;
y = CP_Rotated_AB_y + m_MotionParams.TCP_Y;
z = CP_Rotated_AB_z + m_MotionParams.TCP_Z;
}
HTH