空间工具箱机器人模型

问题描述 投票:0回答:1

我想在空间工具箱中对这些 D-H 参数进行建模:

Link:          alpha,      a,        theta,      d
Link 1 :        -90        0        theta1*      d1
Link 2 :          0        a2       theta2*      0
Link 3 :          0        a3       theta3*      0

这是我尝试过的代码:

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)

但这就是我得到的,仅沿 1 个轴运动:

showmotion机器人模型

如何获得正确的模型?

matlab simulation spatial robotics
1个回答
0
投票

我更改了代码,现在可以正常工作了。

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]);
© www.soinside.com 2019 - 2024. All rights reserved.