Understanding Quaternion to DCM Conversion in Openshoe Matlab Library

  • Thread starter Thread starter namster
  • Start date Start date
  • Tags Tags
    Quaternion
Click For Summary
The discussion centers on the conversion from quaternion to Direction Cosine Matrix (DCM) using the OpenShoe Matlab library. Users express confusion over differing matrix descriptions found online compared to those in the OpenShoe implementation, despite achieving similar results. The specific function in question is "q2dcm," which calculates the DCM based on quaternion inputs. Participants share their experiences and seek clarification on the correctness of the matrix representation used in OpenShoe. The conversation highlights the need for a deeper understanding of quaternion mathematics in relation to DCM conversion.
namster
Messages
2
Reaction score
0
Summary:: Conversion from quaternion to DCM

Hi All ,
our teacher asked us to try to understand the openshoe Matlab library , i stagnate on function that convert the quaternion to DCM i have found many example on website but the description of matrix are diffrente that the one is used on openshoe but it give the same result , so i wan't to know which of this matrix is correcte ?
Q2DCM2.PNG

Q2DCM1.PNG
 

Attachments

  • 1611017261433.png
    1611017261433.png
    307 bytes · Views: 176
Physics news on Phys.org
jedishrfu said:
Are you using this library?

https://sourceforge.net/p/openshoe/home/Home/

or some other one?
yes that's it , i use the Matlab implementation http://www.openshoe.org/?page_id=362

Matlab:
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
%[ 1-p(6)*p(5) p(6)-p(5)           p(6)+p(5)
%  p(6)+p(5)   1-p(6)*(p(1)+p(3))  p(6)-p(5)
%  p(6)-p(5)   p(6)+p(5)           1-p(6)*(p(1)+p(2)) ]

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
 
Last edited by a moderator:

Similar threads

  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 2 ·
Replies
2
Views
10K
  • · Replies 3 ·
Replies
3
Views
2K
Replies
1
Views
2K
Replies
12
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K