实现移动和旋转代码:
%绘制坐标系的移动位姿
clc
clear
close('all')
T1=troty(0);
T2=transl(4,0,0)
T=T2*T1;
p1=[2;4;3;1];
Ap1=T*p1;
%%坐标系逆变换,坐标点正变换
Tr=inv(T);
Bp1=Tr*p1;
%%绘图
T0=transl(0,0,0);
trplot(T0,'frame','A','color','b');
axis([-5 5 -5 5 -5 5]);
hold on,
tranimate(T0,T,'frame','B','color','r')
其他相关函数说明:
平移和旋转矩阵:
transl(x,y,z):(x,y,z)的平移
T1 = transl(0.5,0.0,0.0);
trotx(theta) / troty(theta) / trotz(theta):绕x / y / z轴theta的旋转
R2 = trotx(pi/2)*troty(pi/2)*trotz(-pi/2);
rotx(theta) / roty(theta) / rotz(theta)ÿ