首页 > 解决方案 > 在 matlab 机器人工具箱中模拟 6 自由度机器人

问题描述

我是 matlab 及其机器人工具箱的新手。我正在尝试在 matlab 中模拟 6 DOF 机械手的简单模型,但出现此错误。这是我的代码:

clc

startup_rvc;  
syms th1 th2 th3 th4 th5 
%//////////robot  d-h////////////
%%%%L= Link([ th d a alpha 'joint type'])%%%%
L(1) = Link([th1 0.1519 0 -pi/2 ]);
L(2) = Link([th2 0.1198 0.24365 0 ]);
L(3) = Link([th3 -0.0925 0.21325 0 ]);
L(4) = Link([th4 0.08505 0 -pi/2 ]);
L(5)= Link([th5 0.08535 0 pi/2]);
L(6)= Link([th6 0 0 0]);

robot = SerialLink(L,'name','surgicalarm');
q=[0 0 0 0 0];
robot.plot(q)
robot.teach();

但是当我运行这段代码时,我得到了这个错误:

Error using SerialLink/plot (line 205)
Insufficient columns in q

Error in surgicalarm (line 16)
robot.plot(q)

谁能帮我解决这个问题?谢谢。

标签: matlabrobotics

解决方案


由于您的机器人有 6 个自由度,我希望q也有 6 个列而不是 5 个。

q = [0 0 0 0 0 0]在您的代码中尝试使用。


推荐阅读