calculate difference of euler angles between two dynamic moving objects
조회 수: 6 (최근 30일)
이전 댓글 표시
Hi,
I have two Objekts in same coordinate System. I want to calculate the difference between object1 and object2 in yaw, pitch and roll by comparing the rotation matrix .
If the objects dont move and if it has almoast the same orientation I can calculate each position relative to the origin and compare the angles, this already works verry good.
But if the objcts move and the orientation differs a lot I get allways a wrong angle differnce on one of the axises.
I dont know hot two fix this Problem.
Is there any sollution to calculate the difference between Rotation Matrixes/Quaterions/Axis and Angle and get solid results without singularitys?
Greetings
Florian
댓글 수: 0
채택된 답변
Jim Riggs
2019년 8월 12일
편집: Jim Riggs
2019년 8월 12일
You have two objects described in a common reference frame. Lets call the objects A and B, and the frame is the I frame. So if Direction cosine matrix [I -> A] represents the transformation from the I frame to body A frame, and [I -> B] is the DCM which transforms coordinates from I to body B, then the transformation from A to B is:
[A -> B] = [I -> B] [I -> A]^T (where [I -> A]^T is the transpose of [I -> A]
This is the same as [A -> B] = [I -> B] [A -> I].
Now you can extract the Euler angles from [A -> B] which represent the rotation to get from A to B.
댓글 수: 4
Jim Riggs
2019년 8월 12일
편집: Jim Riggs
2019년 8월 12일
Also note that if it seems like things are going the wrong way, it is possible that the A and B matrix that you get from the rotationVectorToMatrix function are defined opposite what I have assumed, i.e. the A and B matrix might be [A -> I] (in stead of [I -> A] and [B -> I] (in stead of [I -> B]).
If this is the case, then [A -> B] is given by:
[A -> B] = [B -> I]^T [A -> I] = transpose(B) * A
추가 답변 (1개)
Chris
2019년 8월 12일
Are you trying to compare the rotation matries directly or are you compairing the euler angles? I am not sure you can use the matricies directly but looking at the euler angles is a needed first step to debug your code before doing anything more complicated. Also remember to account for heading wrap around at north.
참고 항목
카테고리
Help Center 및 File Exchange에서 Assembly에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!