Results 1 to 7 of 7

Thread: Global frame to local frame

  1. Global frame to local frame

    Hello friends
    Iam naveen and new to this forum.I have a question regarding the transformation matrix from world frame to the base frame of a Spatial serial manipulator. The frames are attached like this. The Z-axes are along the link lengths. The Xi axis is oriented such that Xi = Zi X Zi+1 and Y-axis such that it completes a right-hand system. For the base frame of manipulator the Z-axis is along the First link but the X and Y axes are arbitrary. My world frame is at (0,0,0) at some distance and different orientation to that of robot base frame. World frame orientation is along unit vectors xo = [1 0 0],yo = [0 1 0] and zo = [0 0 1]. I want to know how to calculate the Transformation matrix from world frame to manipulator base frame.To make it clear further the First link is located at some distance and oriented differently with respect to world frame.Iam sucessfully able to calculate the end-effector position withrespect to base frame.But iam not able to transform it withrespect to world frame. I tried in many ways but could not succeed.I will describe the context of the problem below.

    Actually iam modelling the backbone atoms of a RNA molecule as a serial chain hyper-redundant manipulator. The atoms are modelled as joints and bond-lengths as links. The bond-lengths and bond-angles are constants and torsion angles are the variable parameters. The frames are attached as described in the first paragraph. The Z-axes are along the bond-lengths. The Xi axis is oriented such that Xi = Zi X Zi+1 and Y-axis such that it completes a right-hand system.For the first bond the Z axis is along the bond but the X and Y axes can be taken arbitrary.
    The DH parameters are defined as follows. a =0 always for this problem as the bonds intersect(hence the Z-axis), d- distance between X-axis is here is taken as the bond-length, theta is the torsion angle. All DH parameters are calculated from atomic positons of atoms.
    Initially iam trying to calculate the end-atom position(end-effector) withrespect to first-atom(base-frame),for some known values of theta. This iam sucessfully able to do. But Iam not able to calculate end-atom position withrespect to world frame. So i want to know the transformation matrix which relates frame attached to first atom(note that the Z-axis of frame attached to first-atom is oriented along the bond from first-atom to second-atom but X and Y axis are arbitrary) to the world frame.

    Iam assigning frames in a similar manner as given in the lower half of this page: but note that my world frame is different from that described there.

    Thank you for your patience reading of my long describtion of my question.

  2. #2

    Re: Global frame to local frame

    Google for "skeletal animation" for how to chain multiple linked transformations together. Basically, you express the transformation of each "link" as relative to its parent as a matrix, and then multiply them together. If the "world" coordinate space is not the same as the "root," then simply treat the root as yet another link with a transformation matrix. In the end, if you have an assembly with three links and an oriented root, your end transformation matrix would be:

    Mrr * Mtr * Mr1 * Mt1 * Mr2 * Mt2 * Mr3 * Mt3

    Mt3 is the translation (length) of the end joint, in the end joint coordinate space (so, you your case, along Z.) Mr3 is the rotation of the end joint relative to the previous joint, in the previous joints' coordinate space. Mt2 is the translation (length) of the previous joint. Mr1 is the rotation of the parent joint, relative to the root. Mt1 is the translation (length) of the parent joint relative to the root. Mrr is the rotation of the root relative to world space, and finally, Mtr is the position of the root in world space.

    Now, multiplying a position in end effector space (such as 0,0,0 for the actual tip) as a column vector on the right through this transformation, will end up with that same position in world space.

  3. Re: Global frame to local frame

    Thanks for replying. You understood the problem correctly.What iam not getting is the rotation matrix of Mrr.Iam assuming Mtr as zero.Also iam using Homogeneous matrix Representation of Denavit- Hartenberg(DH) Matrix.As you said iam treating the root as yet another link with a transformation matrix. Iam trying to calculate this Mrr matrix as follows.

    As i mentioned before my world frame is at (0,0,0) at some distance and different orientation to that of robot base frame. World frame orientation is along unit vectors xo = [1 0 0],yo = [0 1 0] and zo = [0 0 1].And the root frame has its Z-axis oriented along the first link. Iam calculating root frame X axis orientation as cross-product of zo axis of world frame and z-axis of root frame.
    Now i can calculate DH parameters as follows. a and d are zero as root frame and world frame coincide. alpha is the angle between zo axis of world frame and z-axis of root frame. theta is the angle between xo axis of world frame and x-axis of root frame.This values of DH parameters i will substitute in DH matrix formula(given in Introduction to robotics by J craig) to calculate the Mrr matrix. But when iam premultiplying this matrix to (Mr1 * Mt1 * Mr2 * Mt2 * Mr3 * Mt3 * column vector) it is not giving the correct answer as required in the world space. I think this is because iam doing some mistake in calculating Mrr matrix.
    I want to know if there is any other way of calculating this Mrr matrix.I know one way of doing this is finding the Euler angles.But i dont know to how to calculate the angles the root frame has rotated to come to its present orientation from the world frame. As i said before,i know only the orientation of z-axis of root frame( which is direction vector pointing from first atom to second atom and this direction vector is calculated from position of these atoms).Now how to calculate the angles the root frame has rotated about x,y and z-axis to get to its present orientation

  4. #4

    Re: Global frame to local frame

    Note that you don't want the matrix "from world to root" -- you wan the matrix which is "from root to world," which is the inverse. If your matrix only contains an orthonormal rotation, then the inverse is the same as the transpose, which will save some multiply-add instructions :-)

    Another way of constructing matrices is by direct assignment to two basis vectors, re-construct the third basis vector through a cross product, and then optionally orthonomalizing the matrix if your inputs are not exact. You can do this by observing that the direction of basis vectors in the rotated coordinate system correspond 1:1 to the columns of the rotation matrix (or rows, if you go the other way.)

  5. Re: Global frame to local frame

    Hello Jwatte,
    As you said, i want matrix from root to world, not from world to root . In the last paragraph of my previous message it gives an impression that i want from world to root frame. I had made note of it. But is my method of calculating Mrr is correct?. I think iam correctly calculating Mrr matrix from root to world as described in my previous message.I dont understand what wrong iam doing. I showed the sample script written in matlab to my friends also but they could not figure it out. Iam pasting the matlab script for your seeing also.Please see it and tell me if iam doing anything wrong.Please dont think otherwise.I have explained what iam doing in the script clearly in comments.Please go through it.

    I have used basis vectors method also once. But it gives only the position of second atom correctly in world space. From third atom onwards wrong.I dont understand it. I tried in many ways to get this rotation matrix but without success till now.

    a = [-2.394 -3.885 -12.129]'; %position of first atom or the position of base
    b = [-0.98 -3.229 -11.644]'; %position of second atom
    p = [2.5890 -4.4490 -7.3760]'; % position of end atom
    pwa = p-a; %position of end atom withrespect to first atom(base) and also the
    % expected ANSWER
    u = (b-a)/norm(b-a); %direction vector of z-axis of base frame which is difference in position
    %vector of first and second atoms
    zo = [0 0 1]'; %direction vectors of world frame which is assumed to be coincident but differently
    %oriented withrespect to base frame
    xo = [1 0 0]';
    x1 = cross(zo,u)/norm(cross(zo,u)); % calculating x1-axis of root frame as cross-product of zo-axis of world frame and z-axis of root frame
    t1 = acosd(dot(xo,x1)/(norm(xo)*norm(x1)));% angle theta between xo axis of world and x1 axis of root frame
    a1 = acosd(dot(zo,u)/(norm(zo)*norm(u))); % angle alpha between zo axis of world and z-axis of root frame

    % a=0 as z-axis it is kept zero directly in the formula
    %first element of d vector kept zero as world frame and root frame assumed
    %to coincide
    %aa(alpha) angles are taken to be acute so they are taken 180-values
    %last theta angle taken to be zero as it changes position of (end+1) atom
    %but not end atom
    d = [ 0 1.621 1.420 1.537 1.531 1.423 1.617];
    aa = 180-[ 180-a1 180 122.56 109.96 112.68 112.10 122.35];
    ta = [ t1 120.80 -169.90 -164.24 80.91 -157.45 0];
    T = [ 1 0 0 0; 0 1 0 0; 0 0 1 0; 0 0 0 1];
    for k = 1:7
    T =T * [ cosd(ta(1,k)) -sind(ta(1,k)) 0 0 ;
    sind(ta(1,k))*cosd(aa(1,k)) cosd(ta(1,k))*cosd(aa(1,k)) -sind(aa(1,k)) -sind(aa(1,k))*d(1,k) ;
    sind(ta(1,k))*sind(aa(1,k)) cosd(ta(1,k))*sind(aa(1,k)) cosd(aa(1,k)) cosd(aa(1,k))*d(1,k) ;
    0 0 0 1 ; ];

    %necessary condition for correct ANSWER is that atleast norms should be
    %same which is happening but the final vecors F and pwa are not same.For
    %ANSWER to be exactly correct F(1:3) should be same as pwa.
    F = T * [0 0 0 1]'
    no = norm(pwa)
    no1= norm(F(1:3))

  6. #6

    Re: Global frame to local frame

    I don't know Matlab, and I don't particularly feel like debugging someone else's code over the internet :-)

    What I would do is follow the transformation of a value under certain rotations all the way up the chain, and compare to a real-world model, and see where it goes wrong. Trying this for a few different angles of the topmost and rootmost transform ought to show you what's happening. Once you know that, it should be easy to back-trace the error to the point where you can isolate and correct it.

    Also: you are constructing matrices using trigonometrical functions. I always feel bad when I have to do this, because it generally means that I've lost some dimension of data somewhere. The only case where you should need to use trig is if you have a user interface that's expressed in Euler angles (heading/pitch/roll or whatever) rather than something more useful, like quaternions or basis vectors or whatever. Any real system you interface with should hopefully be able to provide data to you in a better format than Euler angles.

    If there are built-in functions for "rotation matrix creation" then you might want to use those to avoid any typos in that part. You might also want to try by just transposing the matrix you create, to see if it's created the wrong way around.

    Good luck!

  7. Re: Global frame to local frame

    Thanks for the suggestions.I will try to do them

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 01-01-2012, 02:40 AM
  2. Local Club
    By dalocogamer in forum Off Topic
    Replies: 3
    Last Post: 06-23-2010, 01:42 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts