Hello all, I am trying to make a robot move back and forth drawing a line from (10,10,5) to (20,15,5). I make DH Table as follow:
I am trying to utilize the code from a handout in class to do this. This code draws a line from (1,1,0) to (0,2,0). As of now, I know how move the z value to be 5. But from there, any type of adjustment I make to the code will not work. I try to extend link length to 10, I get this error:
addpath 'insert your respective path to rvctools folder here'
startup_rvc
L1=Link([0 5 1 0 ],'standard');
L2=Link([0 0 1 0 ],'standard');
L2.qlim=[10 20];
r=SerialLink([L1 L2]);
x=[];y=[];shoulder=[];elbow=[];
x0=1;y0=1;delta=0.1; %initial position and increment of motion
T=[0 -1 0 x0;1 0 0 y0;0 0 1 0; 0 0 0 1]; %initial transformation matrix
xx0=x0/delta+1;
for i=1:xx0
T(1,4)=x0-(delta*(i-1));
T(2,4)=-T(1,4)+2;
Ti=r.ikine(T, 'q0',[0 pi/4],'mask',[1 1 0 0 0 0], 'deg'); %inverse kinematics
x(i)=T(1,4);
y(i)=T(2,4);
shoulder(i)=Ti(1)*(180/pi);
elbow(i)=Ti(2)*(180/pi);
angles=[shoulder' elbow'];
x1(i)=cos(Ti(1));y1(i)=sin(Ti(1));
end
plot(x,y);axis([-5 5 -5 5 -5 5]);hold on% draw the trajectory
TTT=[(shoulder*pi/180)' (elbow*pi/180)'];plot(r,TTT,'delay',0.2,'loop')
%animation
plot(x',y','-');axis([-5 5 -5 5]); %trajectory
hold on
for ii=(n-1)/2:n-1 %plot the two links
line([0 x1(ii)],[0 y1(ii)]);hold on;
line([x1(ii) x(ii)],[y1(ii) y(ii)]);
hold on
end
grid

And here we get successful animation along line from (1,1,0) to (0,2,0)! But, I want (10,10,5) to (20,15,5)...
I get error when I try to adjust link lengths to 10 like this:
...
L1=Link([0 5 10 0 ],'standard');
L2=Link([0 0 10 0 ],'standard');
L2.qlim=[10 20];
r=SerialLink([L1 L2]);
x=[];y=[];shoulder=[];elbow=[];
x0=10;y0=10;delta=0.1;
...
Now it seems like its moving from (10, -10, 5) to (0, 0,5). I have a feeling that it involves creating a new transformation matrix, so I made this one from the DH Table above:
[0 0 1 5; 0 1 0 10; -1 0 0 0; 0 0 0 1]
and plugged it into T, and it did not work...
Any help would be appreciated please!