Robot Kinematics "Joint Space" The Forward Kinematics (1,2,3, etc) x If we just move linearly, New y = Old z in y and c in z. "World Space" (x, y and z for the end-effector) x a y b + where we have moved a in x, b z c This approach proves to be more versatile: x 1 y 0 z 0 1 0 1 0 0 0 0 0 a x 1 0 b y 0 1 c z 0 0 1 1 0 0 a 1 0 b 0 1 c 0 0 1 is referred to as the Translation Matrix Trans(a,b,c). We can also develop matrices which will let us work out what happens to (x,y,z) when we rotate about an axis. Rotation about y Positive rotation - corkscrew or clockwise rule - clockwise as we face in the positive direction about our axis of rotation. y x z So positive rotation about y is from z to x. z Old z New z 1 r x Old x New x So new x = r sin(1+) = r sin(1) cos() + r cos(1) sin() = old x cos() + old z sin() and new z = r cos(1+) = r cos(1) cos() - r sin(1) sin() = old z cos() - old x sin() y is unchanged, as the rotation was about the y axis. We can produce a matrix to help us calculate the new x and z. rot(y) = cos 0 sin 0 0 sin 1 0 0 cos 0 0 0 0 0 1 We can do similar calculations for rotation about the x and z axes. Rot(x) = Rot(z) = 0 1 0 cos 0 sin 0 0 cos sin 0 0 0 sin cos 0 sin cos 0 0 0 0 0 1 0 0 0 0 1 0 0 1 Why bother with the matrices ? Because: a) They make the calculations easier if more than one operation is involved. b) They make it easier to deal with movements involving rotation about more than one joint of the robot. To demonstrate, suppose we start at (3,3,4), then rotate 90 about the z axis, then move linearly such as to increase x by 2, y by 3 and z by 4; then rotate 45 from the resulting position about the z axis. The 90 rotation about z requires the following matrix: cos 90 sin 90 sin 90 cos 90 0 0 0 0 0 0 0 0 1 0 0 1 0 1 1 0 0 0 0 0 = 0 0 0 0 1 0 0 1 The translation requires: 1 0 0 0 0 0 a 1 0 b 0 1 c 0 0 1 = 1 0 0 0 0 0 2 1 0 3 0 1 4 0 0 1 The 45 rotation about x requires: 0 0 0 1 0 0 1 0 cos sin 0 0 0.707 0.707 = 0 sin cos 0 0 0.707 0.707 0 0 1 0 0 0 0 0 0 0 1 It is specified that we rotate about z first, so we end up at: 0 1 1 0 0 0 0 0 0 0 3 0 0 3 = 1 0 4 0 1 1 3 3 4 1 Now we do the translation: 1 0 0 0 0 0 2 3 1 0 3 3 = 0 1 4 4 0 0 1 1 1 6 8 1 Now to rotate by 45 about x; 0 0 1 0 0.707 0.707 0 0.707 0.707 0 0 0 0 0 0 1 1 6 8 1 = 1 1.414 9.898 1 (NB - final answer different from the notes - I think I am right !) We could equally well operate by multiplying the rotation and translation matrices together and then premultiplying the original position "vector" by the resulting matrix. In multiplying the matrices, we must be careful to put the one representing the first move at the right and proceeding leftwards in order of the operations. 0 1 1 0 0 0 0 0 = 0 0 1 0 0 0 0 1 1 0 0 0 0 1 0 0 0 2 1 0 0 0 3 0 0.707 0.707 1 4 0 0.707 0.707 0 1 0 0 0 0 0 0 1 1 0 2 0 0.707 0 0.707 0.707 0.707 1 0.707 4.949 0 0 1 0 3 3 and premultiplying by the above matrix gives us our resulting final position 4 1 vector. Now for Something More Like a Proper Robot Member B Pivot Pivot Member A y Member C x z Lengths of members between pivots A is 0.8 m long B is 0.6 m long C is 0.5 m long We will suppose that the end-effector is at the origin of the (x,y,z) system of coordinates which we are using. Member A ("The trunk") remains vertical and pivots about its base as shown through an angle 1. Member B rotates about its joint with member A through an angle 2 (positive clockwise as shown) and Member C rotates about its joint with Member B through an angle 3 (positive clockwise as shown). Example - where will the end-effector be after we have rotated C clockwise 25 with the other joints stiff, then rotated B anticlockwise 40 with the other joints stiff, then rotated A 55 such as to bring the other members upwards out of the page ? Answer - first the rotation about the B/C pivot ! Unfortunately the z axis is not through that point but through the end-effector's original position (known as The Home Position). We therefore need to move the z axis vertically upwards so it does go through the pivot. Doing this will leave x and z unchanged but y will now be -0.5 m, so it is as if we moved the end-effector by -0.5 m. 1 0 Translation matrix 0 0 0 0 0 1 0 0.5 , 0 1 0 0 0 1 0 1 0 0 0 1 0 0 . 5 so new position vector = 0 0 1 0 1 0 0 0 0 0 0 0 .5 = . 0 0 1 0 We now want to rotate through 25 clockwise about the z axis; actually -25 as anticlockwise is the positive direction ! cos( 25) sin( 25) sin( 25) cos( 25) Rotation matrix 0 0 0 0 0 0 0.9063 0.4226 0 0 0.4226 0.9063 = 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 1 so the new position vector (NB with the origin at the B/C joint !) will be: 0.9063 0.4226 0.4226 0.9063 0 0 0 0 0 0 0 0.2113 0 0 0.5 0.4532 = 1 0 0 0 0 1 1 1 We now want to rotate clockwise about the A/B joint, so we need to move the origin of the co-ordinate system again. We are moving the origin left by 0.6 m, so it is as if we are moving +0.6 m in x. 1 0 0 0 0 0 0.6 0.2113 0.3887 1 0 0 0.4532 0.4532 = 0 1 0 0 0 0 0 1 1 1 Now we are ready for the rotation about the A/B joint. We are rotating 40 anticlockwise this time about the z axis, so the rotation is positive. cos( 40) sin( 40) sin( 40) cos( 40) 0 0 0 0 0 0 0.3887 0.5891 0 0 0.4532 0.0973 = 0 1 0 0 0 1 1 1 and now the final rotation about y ! Fortunately the y axis goes through our present origin, so we do not need to move the origin again. Our angle of rotation about y is negative, as it is anticlockwise as we face in the direction of the y axis. cos( 55) 0 sin( 55) 0 0 sin( 55) 0 0.5891 0.3379 1 0 0 0.0973 0.0973 = 0 cos( 55) 0 0 0.4825 0 0 1 1 1 So the end-effector is at (0.3379, -0.0973, 0.4825), but that position is relative to the B/C joint. We would like to know where the end-effector is relative to the "Home" position ... We need to move the origin again .. left by 0.6 m and down by 0.5 m. This reduces x by 0.6 and increases y by 0.5. 1 0 0 0 0 0 0.6 0.3379 0.2621 1 0 0.5 0.0973 0.4027 = 0 1 0 0.4825 0.4825 0 0 1 1 1 So the final position using the original co-ordinates is (-0.2621, 0.4027, 0.4825). Your turn ! If we start from the "Home" position again, where will the end-effector be after we rotate C anticlockwise by 20, then rotate B clockwise by 30, then A about its base by 35 such as to move B and C out of the paper ? Would it make any difference if we did the operations in the reverse order ? The Denavit-Hartenberg or "A" Matrix This gadget allows us to find what the co-ordinates will be in one system of coordinates (x,y,z) if we know them in another system of co-ordinates (x,y,z) and we know how the systems relate to each other. It is not necessary for the axes in the two systems to be parallel ! We can bring the two systems into alignment by at most two rotations and two translations. We can demonstrate by using the simple robot example from the previous section. Member B Pivot Pivot Member A y Member C x Lengths of members between pivots A is 0.8 m long B is 0.6 m long C is 0.5 m long z For the rotation about the B/C pivot, it is easy to work out where the end-effector will move to if the origin is at the B/C pivot and the rotation is about one of the axes (z in this instance). What happens if we do the operations in the reverse order ? (-55 about the base, +40 about the A/B pivot, -25 about the B/C pivot) ? Denavit and Hartenberg proposed the following idea. We denote our two sets of axes by (x1, y1, z1) and (x2, y2, z2) and we want to find (x1, y1, z1) given (x2, y2, z2). We take it that we changed the system of axes in the following way: 1) We rotated System 1 about its z-axis through an angle to align the new x axis correctly. 2) We moved the origin along the z-axis by D. ) To position the new 3) We moved the origin along the new x-axis by L. ) origin correctly. 4) We rotated the system about its new x-axis by an angle to align the new z axis correctly. Their result was: sin sin L cos x x cos cos sin y sin cos cos sin cos L sin y z 0 sin cos D z 0 0 1 1 2 1 1 0 (1 = the original axes, 2 = the changed axes). In our example, we did not do the first rotation (so = 0) or shift along z (so D = 0). We moved the origin 0.6 m left (= -0.6 m) along the new x and we did not rotate about the new x axis ( = 0). So the co-ordinates of the end-effector will now be x 1 y 0 z 0 1 1 0 0 0 0 .6 x 1 0 0 y 0 1 0 z 0 0 1 1 2