EDA365电子论坛网

标题: link函数调用 [打印本页]

作者: cichishia    时间: 2020-9-25 11:06
标题: link函数调用
我安装了机器人工具箱,然后在命令行窗口把网上某大神的代码直接贴上,运行显示未定义函数或变量‘link’,matlab新手,请大神解答
' n* A; J6 W' S) Z1 }5 v' o
作者: Uifhjvv    时间: 2020-9-25 11:28
把代码发上来看一下
作者: cichishia    时间: 2020-9-25 13:25
clear;clc;9 t# b, {( w( M2 {5 \3 U$ _% X
close all;
& o* F: c5 S2 N1 |. Ix1=-pi/2; a1=121.16; d1=191.99;: I- ^& d- p' ]! {8 L" C$ A
x2=0; a2=850.94; th2=82.19*pi/180;
$ E" r5 @" d# Q8 V% qx3=0; a3=482.6;9 a1 H+ |3 [$ h) D0 @. [0 _! s. O
x4=pi/2; a4=133.35;0 y+ }9 O7 K, O. B! F
x5=-pi/2; a5=0; th5=pi/2;
* n8 N; H+ V  D" [# Jx6=0; d6=380.9;  e) I+ E& u$ U/ i5 Q$ T) c7 [" i1 `
L(1)=Link([0 d1 a1 x1]); L(1).qlim=[-pi,pi];
# X' [* U6 M& J) fL(2)=Link([0 0 a2 x2]); L(2).qlim=[-pi/6,pi/2];
# G* x% n! e( s4 \$ [L(3)=Link([0 0 a3 x3]); L(3).qlim=[-pi/2,pi/2];
, P* v! @% a3 g3 O+ i6 h3 z6 LL(4)=Link([0 0 a4 x4]); L(4).qlim=[-pi/2,pi/2];
2 I6 v) a2 K& `( ?9 JL(5)=Link([0 0 a5 x5]); L(5).qlim=[-pi/2,pi/2];
5 p0 I. l1 w& ^; ]4 Z' z7 U+ P/ m( F* ML(6)=Link([0 d6 0 x6]); L(6).qlim=[-pi,pi];0 A' s3 W$ w7 I* C
robot6=SerialLink(L,'name','robot6','offset',[0 -th2 th2 0 -th5 0]);/ \: }- _( t( O6 p
%% 轨迹规划-圆2 A: V4 K8 j+ F
Th=0:pi/60:2*pi;R=400;' N; w7 x- I/ e% k& M
for I=1:length(Th)
" S: `# O1 r# {+ s  p; Kj=1:length(Th);
7 V1 v, p6 O' e8 ?x(1,j)=1500;3 B7 {9 a2 ]5 R7 }8 g$ }" S) y% O
y(1,j)=R*sin(Th);  F6 E. m. A) f& {! `
z(1,j)=0+R*cos(Th);
% s% Y  U" {! _( oend
4 `$ a* z# o- g( l1 L7 h! {- Ufor ko=1:length(Th)
$ [: }5 m; k" L2 b( I6 oTTr=[x(ko),y(ko),z(ko)];' Y' B: y2 `2 l3 P+ U: @
TO(:,:,ko)=transl(TTr)*trotz(-90,'deg')*troty(0,'deg')*trotx(-90,'deg');. s7 m0 O/ c5 b+ u
end
; ], l' d+ X! N$ @( P% {+ Aqz=ikine(robot6,TO,'pinv');
+ X) N* ?$ Q5 o& b! {; r+ q/ i2 lplot3(x,y,z,'r','LineWidth',2);6 D8 J' O6 J' c
hold on;; m/ q0 y3 ^9 |
plot(robot6,qz,'loop');' R0 C) D+ H8 Z. t. l+ [, c
hold off;
作者: nkkopd    时间: 2020-9-25 13:33
你用ver看看你的工具箱中是不是有Robotics Toolbox  
作者: IBB-EUT    时间: 2020-9-25 13:40
我觉得你可能没正确安装机器人工具箱。这图片是我复制你的代码运行的结果,虽然有警告,但是是可以正常运行的,产生动画

00000.jpg (15.09 KB, 下载次数: 5)

00000.jpg





欢迎光临 EDA365电子论坛网 (https://bbs.eda365.com/) Powered by Discuz! X3.2