2 Star 8 Fork 2

高动态导航技术北京市重点实验室 / INS_Std Alg

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
q2dcm.m 846 Bytes
一键复制 编辑 原始数据 按行查看 历史
劉寧 提交于 2021-09-10 16:15 . liuning 202109101615 BJ
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% function R=q2dcm(q)
%
%>
%> @brief Function that converts a quaternion vector to a directional
%> cosine matrix (rotation matrix)
%>
%> @param[out] R Rotation matrix.
%> @param[in] q Quaternion vector.
%>
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function R=q2dcm(q)
p=zeros(6,1);
p(1:4)=q.^2;
p(5)=p(2)+p(3);
if p(1)+p(4)+p(5)~=0
p(6)=2/(p(1)+p(4)+p(5));
else
p(6)=0;
end
R(1,1)=1-p(6)*p(5);
R(2,2)=1-p(6)*(p(1)+p(3));
R(3,3)=1-p(6)*(p(1)+p(2));
p(1)=p(6)*q(1);
p(2)=p(6)*q(2);
p(5)=p(6)*q(3)*q(4);
p(6)=p(1)*q(2);
R(1,2)=p(6)-p(5);
R(2,1)=p(6)+p(5);
p(5)=p(2)*q(4);
p(6)=p(1)*q(3);
R(1,3)=p(6)+p(5);
R(3,1)=p(6)-p(5);
p(5)=p(1)*q(4);
p(6)=p(2)*q(3);
R(2,3)=p(6)-p(5);
R(3,2)=p(6)+p(5);
end
Matlab
1
https://gitee.com/bistu_liuning/ins_-std-alg.git
git@gitee.com:bistu_liuning/ins_-std-alg.git
bistu_liuning
ins_-std-alg
INS_Std Alg
master

搜索帮助