Cody

Solution 397860

Submitted on 6 Feb 2014 by J-G van der Toorn
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
%% robot.links=[0.5 0.45 0.3]; robot.jointangles=[0 0 0]; robot = forwardkinematics(robot); yc=robot.attitude; correct_attitude=[0 sum(robot.links) pi/2]; assert(isequal(yc,correct_attitude))

2   Pass
%% robot.links=[0.5 0.45 0.3]; robot.jointangles=[pi/4 0 0]; robot = forwardkinematics(robot); yc=robot.attitude; correct_attitude=[-0.5*sqrt(2)*sum(robot.links) 0.5*sqrt(2)*sum(robot.links) 3*pi/4]; assert(isequal(yc,correct_attitude))

3   Pass
%% robot.links=[0.5 0.45 0.3]; robot.jointangles=[pi/4 pi 3*pi/4]; robot = forwardkinematics(robot); yc=robot.attitude correct_attitude=[-0.5*sqrt(2)*(robot.links(1)-robot.links(2)) 0.5*sqrt(2)*(robot.links(1)-robot.links(2))+robot.links(3) pi/2] assert(all(abs(yc-correct_attitude)<=eps))

yc = -0.0354 0.3354 1.5708 correct_attitude = -0.0354 0.3354 1.5708

4   Pass
%% robot.links=[0.5 0.45 0.3]; robot.jointangles=[-pi/4 pi/4 0]; robot = forwardkinematics(robot); yc=robot.attitude; correct_attitude=[0.5*sqrt(2)*robot.links(1) 0.5*sqrt(2)*robot.links(1)+sum(robot.links(2:3)) pi/2]; assert(all(abs(yc-correct_attitude)<=eps))

5   Pass
%% robot.links=[0.5 0.45 0.3]; robot.jointangles=[-2.1513 2.9568 2.8725]; robot = forwardkinematics(robot); yc=robot.attitude correct_attitude=[0.246878929631356 -0.220349832044192 5.248796326794897] assert(all(abs(yc-correct_attitude)<=1e-8))

yc = 0.2469 -0.2203 5.2488 correct_attitude = 0.2469 -0.2203 5.2488

6   Pass
%% robot.links=[0.5 0.45 0.3]; robot.jointangles=[-0.0919 1.8867 -2.2501]; robot = forwardkinematics(robot); yc=robot.attitude correct_attitude=[-0.260952279814086 0.667368060676958 1.115496326794896]; assert(all(abs(yc-correct_attitude)<=1e-8))

yc = -0.2610 0.6674 1.1155

7   Pass
%% robot.links=[0.5 0.45 0.3]; robot.jointangles=[-0.4916 2.6121 1.8360]; robot = forwardkinematics(robot); yc=robot.attitude correct_attitude=[0.070611406176580 -0.000086942065283 5.527296326794897]; assert(all(abs(yc-correct_attitude)<=1e-8))

yc = 0.0706 -0.0001 5.5273