Matlab Robotic Toolbox 工具箱学习笔记(一)软件:matlab2025a工具箱:Matlab Robotic Toolbox v9.8Matlab 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/Trajectoryclear;clc;p0 = -1;% 定义初始点及终点位置p1 = 2;p = tpoly(p0, p1, 50);% 取步长为 50figure(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(p...