2、matlab串联机器人正反解计算
时间:2022-11-12 15:30:00
使用工具箱正反解计算
clear; clc; %建立机器人模型 %alpha:连杆扭角; %a:连杆长度 %theta:关节转角; %d:关节距离; %offset:偏移 % theta d a alpha offset L1=Link([0 0.4 0.025 pi/2 0 ]); %定义连杆D-H参数 L2=Link([pi/2 0 0.56 0 0 ]); L3=Link([0 0 0.035 pi/2 0 ]); L4=Link([0 0.515 0 pi/2 0 ]); L5=Link([pi 0 0 pi/2 0 ]); L6=Link([0 0.08 0 0 0 ]); robot=SerialLink([L1 L2 L3 L4 L5 L6],'name','BiPan'); %连接连杆,机器人命名BiPan %theta=[0,0,0,0,0,0,0,0,0 %指定关节角 theta=[0,pi/2,0,0,pi,0]; %指定关节角 p=robot.fkine(theta) %fkine正解函数,根据我们给定的关节角theta,解决终端位置p q=robot.ikine(p) %ikine逆解函数,根据我们给定的终端位置p,解决关节角q robot.plot([0,pi/2,0,0,pi,0]); 输出机器人模型的%,输出时背面的六个角theta姿态 teach(robot);