发那科机器人xyz的方向_四足机器人建模仿真(蜘蛛构型,matlab版本)
发布日期:2021-06-24 14:06:21
浏览次数:2
分类:技术文章
本文共 3677 字,大约阅读时间需要 12 分钟。
首先!不建议用matlab做足式机器人仿真。。。学点理论还是可以的。。
我们的目标是制造一个四条腿行走的机器人。我们从创建一个三轴机器人开始
我们用胳膊作为腿,为这条腿规划一条适合行走的轨迹,还有
然后实例化这条腿的四个实例来创建行走机器人。
在运动学上,机器人腿很像机器人手臂。 对于这种应用,三个关节串联机械手是足够的,因为脚与地面有点接触,方向不重要。 确定Denavit-Hartenberg参数,即使是这样一个简单的机器人,也是一个涉及的过程,零角偏移需要在一个单独的步骤中确定。 第一关节将是髋关节运动,向前和向后,这是围绕z轴或Rz(Q1)旋转)。 第二个关节是髋关节上下运动,这是围绕x轴,Rx(Q2)旋转)。 这些构成球形髋关节,因为旋转轴相交。 膝盖由L1在y方向或Ty(L1)翻译)。 第三个关节是膝关节运动,朝向和远离身体,这是Rx(Q3)。 脚由L2在z方向或Tz(L2)翻译)。 因此,该机器人从臀部到脚趾的变换序列是Rz(Q1)Rx(Q2)Ty(L1)Rx(Q3)Tz(L2)。
下面式命令
>> s = 'Rz(q1) Rx(q2) Ty(L1) Rx(q3) Tz(L2)';>> dh = DHFactor(s) DH(q1+90, 0, 0, 90).DH(q2, 0, L1, 0).DH(q3-90, 0, -L2, 0) .Rz(+90).Rx(-90).Rz(-90) >> dh.tool ans = trotz(pi/2)* trotx(-pi/2)*trotz(-pi/2)>> dh.command('leg') ans = SerialLink([0, 0, 0, pi/2, 0; 0, 0, L1, 0, 0; 0, 0, -L2, 0, 0; ], 'name', 'leg', 'base', eye(4,4), 'tool', trotz(pi/2)*trotx(-pi/2)*trotz(-pi/2), 'offset', [pi/2 0 -pi/2 ])>> L1 = 0.1; L2 = 0.1; >> leg = eval( dh.command('leg') )
建模完毕
%对于零关节角度,脚处于>> transl( leg.fkine([0,0,0]) ) ans = 0 0.1000 0.1000 %画出零位机器人>> leg.plot([0,0,0], 'nobase', 'noshadow', 'notiles') >> set(gca, 'Zdir', 'reverse'); view(137,48);
四条腿开始
clear all%leg length L1=0.1;L2=0.1;%form a leg leg=SerialLink([0, 0, 0, pi/2; 0, 0, L1, 0; 0, 0, -L2, 0 ],... 'name', 'leg', 'base', eye(4,4),'tool', ... trotz(pi/2)*trotx(-pi/2)*trotz(-pi/2),'offset', [pi/2 0 -pi/2]);% %diplay the leg %leg.plot([0 0 0],'nobase','noshadow');% set(gca,'Zdir','reverse');view(137,48);%body wide and lengthW = 0.1; L = 0.2;%form a bodylegs(1) = SerialLink(leg, 'name', 'leg1');legs(2) = SerialLink(leg, 'name', 'leg2', 'base', transl(-L, 0, 0));legs(3) = SerialLink(leg, 'name', 'leg3', 'base', transl(-L, -W, 0)*trotz(pi));legs(4) = SerialLink(leg, 'name', 'leg4', 'base', transl(0, -W, 0)*trotz(pi));% create a fixed size axis for the robot, and set z positive downwardclf;axis([-0.3 0.1 -0.4 0.2 -0.15 0.05]); set(gca,'Zdir', 'reverse')hold onfor i=1:4 hold on legs(i).plot([0 -pi/6 0],'nobase','noshadow');end%画身体立方体plotcube([0.2 0.1 -0.01],[ -0.2 -0.1 0],.8,[1 0 0]);
function plotcube(varargin)% PLOTCUBE - Display a 3D-cube in the current axes%% PLOTCUBE(EDGES,ORIGIN,ALPHA,COLOR) displays a 3D-cube in the current axes% with the following properties:% * EDGES : 3-elements vector that defines the length of cube edges% * ORIGIN: 3-elements vector that defines the start point of the cube% * ALPHA : scalar that defines the transparency of the cube faces (from 0% to 1)% * COLOR : 3-elements vector that defines the faces color of the cube%% Example:% >> plotcube([5 5 5],[ 2 2 2],.8,[1 0 0]);% >> plotcube([5 5 5],[10 10 10],.8,[0 1 0]);% >> plotcube([5 5 5],[20 20 20],.8,[0 0 1]);% Default input argumentsinArgs = { ... [10 56 100] , ... % Default edge sizes (x,y and z) [10 10 10] , ... % Default coordinates of the origin point of the cube .7 , ... % Default alpha value for the cube's faces [1 0 0] ... % Default Color for the cube };% Replace default input arguments by input valuesinArgs(1:nargin) = varargin;% Create all variables[edges,origin,alpha,clr] = deal(inArgs{:});XYZ = { ... [0 0 0 0] [0 0 1 1] [0 1 1 0] ; ... [1 1 1 1] [0 0 1 1] [0 1 1 0] ; ... [0 1 1 0] [0 0 0 0] [0 0 1 1] ; ... [0 1 1 0] [1 1 1 1] [0 0 1 1] ; ... [0 1 1 0] [0 0 1 1] [0 0 0 0] ; ... [0 1 1 0] [0 0 1 1] [1 1 1 1] ... };XYZ = mat2cell(... cellfun( @(x,y,z) x*y+z , ... XYZ , ... repmat(mat2cell(edges,1,[1 1 1]),6,1) , ... repmat(mat2cell(origin,1,[1 1 1]),6,1) , ... 'UniformOutput',false), ... 6,[1 1 1]);cellfun(@patch,XYZ{1},XYZ{2},XYZ{3},... repmat({clr},6,1),... repmat({'FaceAlpha'},6,1),... repmat({alpha},6,1)... );view(3);
转载地址:https://blog.csdn.net/weixin_33309433/article/details/112279160 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
很好
[***.229.124.182]2024年04月09日 09时25分33秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
JXFCZX — 花店橱窗(动态规划)
2019-04-28
JXFCZX — 逃亡的准备(多重背包)
2019-04-28
JXFCZX — 庆功会(多重背包)
2019-04-28
AcWing - 扩展欧几里得算法(扩欧)
2019-04-28
AcWing - 高斯消元解线性方程组(高斯消元)
2019-04-28
AcWing - 求组合数 I(递推)
2019-04-28
AcWing - 求组合数 II(预处理&逆元)
2019-04-28
AcWing - 求组合数 III(lucas&逆元)
2019-04-28
AcWing - 求组合数 IV(分解质因数)
2019-04-28
AcWing - 满足条件的01序列(组合数学&卡特兰数)
2019-04-28
AcWing - 快速排序(快排)
2019-04-28
AcWing - 归并排序(归排)
2019-04-28
AcWing - 数的范围(二分)
2019-04-28
AcWing - 数的三次方根(二分)
2019-04-28
AcWing - 高精度加法(大数加法)
2019-04-28
AcWing - 高精度减法(大数减法)
2019-04-28
AcWing - 高精度乘法(大数乘法)
2019-04-28
AcWing - 高精度除法(大数除法)
2019-04-28
AcWing - 前缀和(前缀和)
2019-04-28
AcWing - 子矩阵的和(二维前缀和)
2019-04-28