Positioning a Robot Ann

Figure 10.2-2 shows a robot arm having two joints and two links. The angles of rotation
of the motors at the joints are 8. and (h. From tri gonornetry we can derive the following


expressions for the (x, y) coordinates of the hand: x = L, cos 9, + L2 cos(9, + 92) y = L, sin9, + L2 sin(9, +92) Suppose that the link lengths are L, = 4 ft and L2 = 3 ft. (a) Compute the motor angles required to position the hand at x = 6 ft, y = 2 ft. (b) It is desired to move the hand along the straight line where x is constant at 6 ft
and y varies from y =0.1 to y =3.6 ft. Obtain a plot of the required motor angles as a function of y.
a) Substituting the given values of L” L2, x, and y into the above equations gives 6 = 4cos9, + 3cos(8, +~r
2 = 4sin9, + 3sin(8, +~)
The following session solves these equations. The variables th1 and th2 represent 9, and~.
»5 = polve(‘4*cos(th1)+3*cos(th1+th2)=6’, … ‘4*sin(th1)+3*sin(th1+th2)=2’) S
th1: [2×1 sym) th2: [2×1 sym) »doub1e(5.th1)*(180/pi) % convert from radians to degrees
-3.2981 40.1680 »double(S.th2)*(180/pi) % conv~r~ from radians to degrees
Thus there are two solutions. The·fi:-st is 9, = -3.2981°,92 = 51.3178°, This is called the “elbow-down” sohni-n. The second solution is9, =40. 168°, ~ = -51.3178°,

This is called the “elbow-up” solution. When a problem can be solved numerically, as in this case, the solve function will not perform a symbolic solution. In part (b), however, the symbolic solution capabilities of the sol ve function are put to use. (b) First we find the solutions for the motor angles in terms of the variable y. Then
we evaluate the solution for numerical values of y and plot the results. The script file is shown below. Note that because the problem has three symbolic variables, we must tell the sol ve function that we want to solve for 8( and 82, S = solve(‘4*cos(th1)+3*cos(th1+th2)=6′, …,4*sin (th1 )+3*sin (th1+th2 )=y’, ‘th1′,’ th2 ‘);
yr = [1:0.1:3.6);
th1r [subs(S.th1(1), ‘y’,yr);subs(s.th1(2), ‘y’,yr»);
th2r [subs(S.th2 (1),’v ‘ .vr) ;subs(s.th2 (2), ‘v ‘ ,yr»);
th1d (180/pi)*th1r;
th2d (180/pi)*th2r;
subplot (2,1,1)
plot(yr,th1d,2,-3.2981, ‘x’,2,40.168, ‘0’) ,xlabel(‘y (feet) ‘),…
ylabel(‘Theta1 (degrees) ‘)
subplot (2,1,2) , , , , \ r ,
plot(yr,th2d,2,-51.3178, 0 ,2,51.3178, x ),x1abelf y (feet) )
ylabel(‘Theta2 (degrees) ‘)
The results are shown in Figure 10.2-3, where we have mark~ the solutions from
part (a) to check the validity of the symbolic solutions. The elbow-up \olutions are marked


ith an 0, and the elbow-down solutions are marked with an x. We could have printed the expression for the solutions for {}I and (}2 as functions of y, but the expressions are cumbersome and unnecessary if all we want is the plot. MATLAB is powerful enough to solve the robot arm equations for arbitrary vales of the hand coordinates (x, y). However, the resulting expressions for {}I and (}2 are omplicated.


Share This