Understanding Quaternion to DCM Conversion in Openshoe Matlab Library

  • Thread starter namster
  • Start date
  • Tags
    Quaternion
In summary, The conversation is about a function that converts quaternion to DCM and the confusion about which matrix to use in the OpenSHOE Matlab library. The function in question is q2dcm and it uses a specific set of calculations to convert the quaternion values to a DCM matrix. The conversation also mentions the website where the library can be found and confirms that the library being used is the Matlab implementation from the OpenSHOE website.
  • #1
namster
2
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: 112
Physics news on Phys.org
  • #3
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:

1. What is a Quaternion to DCM conversion?

A Quaternion to DCM conversion is a mathematical process used to convert a quaternion, which is a four-dimensional representation of rotation, into a Direction Cosine Matrix (DCM), which is a three-dimensional representation of rotation. This conversion is commonly used in aerospace engineering and robotics to represent and manipulate rotations in three-dimensional space.

2. Why is a Quaternion to DCM conversion necessary?

A Quaternion to DCM conversion is necessary because it allows for a more efficient and accurate representation of rotations in three-dimensional space. Quaternions are more compact and less prone to numerical errors compared to other representations, making them ideal for use in complex calculations and simulations.

3. How is a Quaternion to DCM conversion performed?

A Quaternion to DCM conversion is performed using a series of mathematical equations that involve the components of the quaternion and the elements of the DCM. The exact equations used may vary depending on the programming language or software being used, but they all follow the same principles of converting between the two representations.

4. What are some applications of Quaternion to DCM conversion?

Quaternion to DCM conversion has many applications in fields such as aerospace engineering, robotics, and computer graphics. It is used to represent and manipulate rotations in three-dimensional space, making it useful in tasks such as spacecraft attitude control, navigation, and animation.

5. Are there any limitations to Quaternion to DCM conversion?

One limitation of Quaternion to DCM conversion is that it is only applicable for three-dimensional rotations. It cannot be used to represent rotations in higher dimensions. Additionally, the conversion process may introduce small errors, so it is important to carefully consider the precision and accuracy requirements of the application when using this conversion method.

Similar threads

Replies
2
Views
2K
  • Computing and Technology
Replies
3
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Precalculus Mathematics Homework Help
Replies
1
Views
1K
  • Mechanical Engineering
Replies
2
Views
716
  • Linear and Abstract Algebra
Replies
2
Views
7K
  • Introductory Physics Homework Help
Replies
3
Views
1K
Replies
1
Views
740
  • General Math
Replies
11
Views
1K
Back
Top