我想在2-DOF平面(2D)手臂上覆盖两个图像(forearm.jpg和wrist.jpg)(下面的代码)。任何建议都将不胜感激。
length = 200;
L1 = 11; %set length of forarm, L1, and wrist, L2
L2 = 8;
figure;
data = transpose([linspace(0,1,length); linspace(0,1,length); 1:length]); %dummy data
time = 0; %initialize time
i = 1; %initialize counter
h = animatedline;
while(time<=length-1)
theta1 = (pi/180) * (170*data(i,1)); %map data to rotational space
theta2 = (pi/180) * (135*data(i,2) - 45);
time = data(i,3);
i = i + 1; %count
clearpoints(h)
h = animatedline([0, L1 * cos(theta1), L1 * cos(theta1) + ...
L2 * cos(theta1 + theta2)], [0, L1 * sin(theta1), ...
L1 * sin(theta1) + L2 * sin(theta1 + theta2)]);
axis([-20 20 -10 20]);
drawnow
pause(0.001)
end