Non-planar robot Dynamics error using Roy Featherstone's Spatial toolbox

I am using this code to test robot dynamics of above robot using Spatial Toolbox:
FDab(rob, [0;0;0], [0;0;0], [0;0;0])
But it gives error:
Error using *
Inner matrix dimensions must agree.
Error in FDab (line 49)
a{i} = Xup{i} * -a_grav + c{i};
This is because Xup is 6x6 double whereas a_grav is 1x3.
The 3 link non-planar robot is given as:
rob.NB = 3;
rob.parent = [0:2];
rob.jtype = { 'R', 'R', 'R' }
model.gravity = [0 0 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]);
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} = ...
{ 'cyl', [0 0 0; 0.11 0 0], 0.05, ...
'cyl', [0 0 -0.06; 0 0 0.06], 0.06 };
rob.appearance.body{2} = ...
{ 'cyl', [0 0 0; 0.34 0 0], 0.05, ...
'cyl', [0 0 -0.06; 0 0 0.06], 0.06 };
rob.appearance.body{3} = ...
{ 'cyl', [0 0 0; 0.26 0 0], 0.05, ...
'cyl', [0 0 -0.06; 0 0 0.06], 0.06 };
showmotion(rob)
How can I overcome the error?

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Coordinate Transformations 的更多信息

产品

版本

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by