文档详情

Matlab Robotic Toolbox工具箱学习笔记.docx

发布:2017-05-17约9.41千字共16页下载文档
文本预览下载声明
Matlab Robotic Toolbox工具箱学习笔记(一) 软件:matlab2013a 工具箱:Matlab Robotic Toolbox v9.8 Matlab Robotic Toolbox工具箱学习笔记根据Robot Toolbox demonstrations目录,将分三大部分阐述: 1、General(Rotations,Transformations,Trajectory) 2、Arm(Robot,Animation,Forwarw kinematics,Inverse kinematics,Jacobians,Inverse dynamics,Forward dynamics,Symbolic,Code generation) 3、Mobile(Driving to a pose,Quadrotor,Braitenberg,Bug,D*,PRM,SLAM,Particle filter) General/Rotations %绕x轴旋转pi/2得到的旋转矩阵 (1)r = rotx(pi/2); %matlab默认的角度单位为弧度,这里可以用度数作为单位 (2)R = rotx(30, deg) * roty(50, deg) * rotz(10, deg); %求出R等效的任意旋转变换的旋转轴矢量vec和转角theta (3)[theta,vec] = tr2angvec(R); %旋转矩阵用欧拉角表示,R = rotz(a)*roty(b)*rotz(c) (4)eul = tr2eul(R); %旋转矩阵用roll-pitch-yaw角表示, R = rotx(r)*roty(p)*rotz(y) (5)rpy = tr2rpy(R); %旋转矩阵用四元数表示 (6)q = Quaternion(R); %将四元数转化为旋转矩阵 (7)q.R; ?%界面,可以是“rpy”,“eluer”角度单位为度。 (8)tripleangle(rpy); General/Transformations %沿x轴平移0.5,绕y轴旋转pi/2,绕z轴旋转-pi/2 ?(1)t = transl(0.5, 0.0, 0.0) * troty(pi/2) * trotz(-pi/2) %将齐次变换矩阵转化为欧拉角 (2)tr2eul(t) %将齐次变换矩阵转化为roll、pitch、yaw角 (3) tr2rpy(t) General/Trajectory clear; clc; p0 = -1;% 定义初始点及终点位置 p1 = 2; p = tpoly(p0, p1, 50);% 取步长为50 figure(1); plot(p);%绘图,可以看到在初始点及终点的一、二阶导均为零 [p,pd,pdd] = tpoly(p0, p1, 50);%得到位置、速度、加速度 %p为五阶多项式,速度、加速度均在一定范围内 figure(2); subplot(3,1,1); plot(p); xlabel(Time); ylabel(p); subplot(3,1,2); plot(pd); xlabel(Time); ylabel(pd); subplot(3,1,3); plot(pdd); xlabel(Time); ylabel(pdd); %另外一种方法: [p,pd,pdd] = lspb(p0, p1, 50); figure(3); subplot(3,1,1); plot(p); xlabel(Time); ylabel(p); subplot(3,1,2); plot(pd); xlabel(Time); ylabel(pd);% 可以看到速度是呈梯形 subplot(3,1,3); plot(pdd); xlabel(Time); ylabel(pdd); %三维的情况: p = mtraj(@tpoly, [0 1 2], [2 1 0], 50); figure(4); plot(p) %对于齐次变换矩阵的情况 T0 = transl(0.4, 0.2, 0) * trotx(pi);% 定义初始点和目标点的位姿 T1 = transl(-0.4, -0.2, 0.3) * troty(pi/2) * trotz(-pi/2); T = ctraj(T0, T1, 50); first=T(:,:,1);%初始位姿矩阵 tenth=T(:,:,10);%第十个位姿矩阵 figure(5); tranimate(T);%动画演示坐标系自初始点运动到目标点的过程 Matlab Robotic Toolbox工具箱学习笔记(二) Arm/Robots 机器人是由多个连杆连接而成的,机器人关节分
显示全部
相似文档