[robot]Quaternions and Rigid Transformations

四元数定义

四元数

单位四元数

unit-quaternions
unit
这一性质十分有用。
由于多次的旋转矩阵间相乘会导致误差累积,相乘次数越多误差越大。
如果利用单位四元数表示旋转矩阵,相乘后得到另一个单位四元数,这时对这个四元数进行renormalize就可以提高精度。

group

共轭

conjugate

先进性

advantages

这一表示形式在机器人学,计算机视觉有着广泛应用。

旋转表示方式的总结

summary

rigid-transformation

rigid-transformation

rigid-trans

44
product

inverting rigid transformation

inverting-rigid-Transformation

SpecialEulerianGroup

se3
se30

exercise

00
01
02
03

code

function q=quatprod(q1,q2)
    % All quaternions q, q1 and q2 are represented as 1-by-4 row vectors 
    q=zeros(1,4);
    u0 = q1(1);
    u = q1(2:end);
    v0 = q2(1);
    v = q2(2:end);


    q(1)= u0 * v0 - u * v';
    temp = u0 * v + v0 * u + cross(u, v);
    q(2)=temp(1);
    q(3)=temp(2);
    q(4)=temp(3);


end

visualized rotation

% rand(3,1) generates a random 3 by one column vector. We use this u to plot
u=rand(3,1)*2-1;

% plot the origin
plot3(0,0,0,'.k')

% axis setting
axis vis3d
axis off


% generate a random rotation matrix R
theta = 2*pi*rand();
w = rand(1,3);
w = w / norm(w);

k0 = cos(theta/2);
k = sin(theta/2) * w;

R = (k0^2 - (k*k'))*eye(3) + 2*k0*[0,-k(3),k(2);k(3),0,-k(1);-k(2), k(1),0] + 2 * (k' * k);

% plot the x axis 
plot3([0,1],[0,0],[0,0],'r');
text(1,0,0,'x');
hold on;
% plot the y axis 
plot3([0,0],[1,0],[0,0],'g');
text(0,1,0,'y');
hold on;
% plot the z axis 
plot3([0,0],[0,0],[1,0],'b');
text(0,0,1,'z');
hold on;
% plot the original vector u
plot3([0,u(1)],[0,u(2)],[0,u(3)],'k--'); % black-dashed-line
text(u(1),u(2),u(3),['u','(',num2str(u(1),'%.3f'),',',num2str(u(2),'%.3f'),',',num2str(u(3),'%.3f'),')']);
hold on;
% apply rotation and calcuate v plot the vector after rotation v
v = R * u;

% plot the new vector v
plot3([0,v(1)],[0,v(2)],[0,v(3)],'k:'); % black-dotted-line
text(v(1),v(2),v(3),['v','(',num2str(v(1),'%.3f'),',',num2str(v(2),'%.3f'),',',num2str(v(3),'%.3f'),')']);
hold on;

result

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值