Going from KUKA Euler angles to transformation matrix.

  • Hi.


    I've recently run a series of tests on a KR-60 Robot using a KRC2 controller.


    I have position data at the tool center point, in the tool frame and I'm interested in getting position data from a DIFFERENT point on the tool for which I have the coordinates in the tool frame.


    I've created a 4x4 transformation matrix that represents the motion of the tool during the test, and I will multiply the vector of the point I'm interested in by that matrix to get its final position.


    The only thing I'm a bit confused about is the KUKA representation of Euler angles, and I'd like to make sure I'm doing the right thing since we will be publishing this data in a scientific journal.


    I'm under the impression that the angles are represented as INTRINSIC X''Y'Z Euler angles starting with Z (A), then Y (B), then X (C)


    So, to construct a rotation matrix from thos angles I need the matrix
    R=X''Y'Z which would be equivalent to R=ZYX where


    X=[1 0 0
    0 cos(C) -sin(C)
    0 sin(C) cos(C)]


    Y=[cos(B) 0 sin(B)
    0 1 0
    sin(B) 0 cos(B)]


    Z=[cos(A) -sin(A) 0
    sin(A) cos(A) 0
    0 0 1]


    Is this the correct way to compute a rotation matrix from the KUKA euler angles A,B,C?


    Thanks for your help.

  • Place your Ad here!
  • I wrote a set of Linear algebra routines for KUKA.
    Computing a matrix from ABC Euler angles:
    public static double[][] matrix(double aDeg, double bDeg, double cDeg) {
    //ABC: Euler angles, A: round z-axis B: round y-axis C: round y-axis
    double a = -aDeg * PI / 180;
    double b = -bDeg * PI / 180;
    double c = -cDeg * PI / 180;
    double ca = Math.cos(a);
    double sa = Math.sin(a);
    double cb = Math.cos(b);
    double sb = Math.sin(b);
    double cc = Math.cos(c);
    double sc = Math.sin(c);
    double[][] tt = new double[3][];
    tt[0] = new double[] { ca * cb, sa * cc + ca * sb * sc, sa * sc - ca * sb * cc };
    tt[1] = new double[] { -sa * cb, ca * cc - sa * sb * sc, ca * sc + sa * sb * cc};
    tt[2] = new double[] { sb, -cb * sc, cb * cc };
    return tt;
    }


    applying the matrix: a is the rotation marix, b is the vector
    public static double[] mul(double[][] a, double[] b) {
    double[] re = new double[3];
    int len = a[0].length;
    if (len == 4) { // matrix a[][] includes both rotation and the position of the current frame
    for (int i = 0; i < 3; i++)
    re[i] = a[i][0] * b[0] + a[i][1] * b[1] + a[i][2] * b[2] + a[i][3];
    }
    else if (len == 3) { // only rotation
    for (int i = 0; i < 3; i++)
    re[i] = a[i][0] * b[0] + a[i][1] * b[1] + a[i][2] * b[2];
    }
    return re;
    }


    Very often, one computes the matrix from both Euler angles (ABC) and the position (XYZ) of the current frame as:
    public static double[][] matrix(double x, double y, double z, double aDeg, double bDeg, double cDeg) {
    double a = -aDeg * PI / 180;
    double b = -bDeg * PI / 180;
    double c = -cDeg * PI / 180;
    double ca = Math.cos(a);
    double sa = Math.sin(a);
    double cb = Math.cos(b);
    double sb = Math.sin(b);
    double cc = Math.cos(c);
    double sc = Math.sin(c);
    double[][] tt = new double[3][];
    tt[0] = new double[] { ca * cb, sa * cc + ca * sb * sc, sa * sc - ca * sb * cc, x };
    tt[1] = new double[] { -sa * cb, ca * cc - sa * sb * sc, ca * sc + sa * sb * cc, y };
    tt[2] = new double[] { sb, -cb * sc, cb * cc, z };
    return tt;
    }
    Hope it’s helpful.

  • Great, thanks for the clarification everyone.


    Panic mode: Good catch, and thanks for confirming that I am multiplying the matrices in the correct order.


    Fubini, for future tests I'll definitely have a look at that. For now it's too late since we already have all the data but that's a great tip, I can use it to check my own matrix calculation vs the built-in one.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account
Sign up for a new account in our community. It's easy!
Register a new account
Sign in
Already have an account? Sign in here.
Sign in Now

Advertising from our partners