Spatial toolbox robot model

1 回表示 (過去 30 日間)
Mohsina Zafar
Mohsina Zafar 2019 年 7 月 19 日
回答済み: Mohsina Zafar 2019 年 7 月 22 日
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.

採用された回答

Mohsina Zafar
Mohsina Zafar 2019 年 7 月 22 日
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 件)

カテゴリ

Help Center および File ExchangeGrid Lines, Tick Values, and Labels についてさらに検索

タグ

製品


リリース

R2016a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by