MATLAB Answers

0

Spatial toolbox robot model

Asked by Mohsina Zafar on 19 Jul 2019
Latest activity Answered by Mohsina Zafar on 22 Jul 2019
I want to model these D-H parameters in spatial toolbox:
Link: alpha, a, theta, d
Link 1 : -90 0 theta1* d1
Link 2 : 0 a2 theta2* 0
Link 3 : 0 a3 theta3* 0
This is the code I have tried:
n=3;
rob.NB = n;
rob.parent = [0:n-1];
rob.jtype = { 'R', 'R', 'R' }
l2=0.28; %link length
l3=0.2; %link length
d1=0.05; %link offset
rob.Xtree{1} = rotx(pi)*xlt([0,0,0]);
rob.Xtree{2} = rotz(0)*xlt([l2 0 0]);
rob.Xtree{3} = xlt([l3 0 0]);
ax1=0.03; ay1=0.03; az1=0.03;
ax2=0.28; ay2=0.05; az2=0.05;
ax3=0.2; ay3=0.05; az3=0.05;
rob.I{1} = mcI( 1, [0 0 -0.02], 1/12*[ay1^2+az1^2 0 0; 0 ax1^2+az1^2 0; 0 0 ax1^2+ay1^2] )
rob.I{2} = mcI( 4, [0.14 0 0], 4/12*[ay2^2+az2^2 0 0; 0 ax2^2+az2^2 0; 0 0 ax2^2+ay2^2] )
rob.I{3} = mcI( 3, [0.1 0 0], 3/12*[ay3^2+az3^2 0 0; 0 ax3^2+az3^2 0; 0 0 ax3^2+ay3^2] )
rob.appearance.base = ...
{ 'box', [-0.2 -0.3 -0.2; 0.2 0.3 -0.07] };
rob.appearance.body{1} = ...
{ 'box', [0 -0.07 -0.04; 0.05 0.07 0.04], ...
'cyl', [0 -0.07 0; 0 0.07 0], 0.06 };
rob.appearance.body{2} = ...
{ 'box', [0 -0.07 -0.04; 0.28 0.07 0.04], ...
'cyl', [0 0 -0.07; 0 0 0.07], 0.06 };
rob.appearance.body{3} = ...
{ 'box', [0 -0.07 -0.04; 0.2 0.07 0.04], ...
'cyl', [0 0 -0.07; 0 0 0.07], 0.06 };
showmotion(rob)
But this is what I get, with motion only along 1 axis:
showmotion.jpg
Kindly help how to get the model right.

  0 Comments

Sign in to comment.

Products


Release

R2016a

1 Answer

Answer by Mohsina Zafar on 22 Jul 2019
 Accepted Answer

I changed the code and now it works properly.
rob.Xtree{1} = rotx(1.57) * xlt([0 0 0]);
rob.Xtree{2} = roty(1.57) * xlt([0.15,0,0]);
rob.Xtree{3} = xlt([0.34 0 0]);

  0 Comments

Sign in to comment.