Calculate difference in Euler angle

조회 수: 5 (최근 30일)
Sharah
Sharah 2016년 9월 27일
편집: Guillaume 2016년 9월 27일
Hello. I have a set of Euler data (yaw, pitch roll). I need to calculate the relative differences in the, for example, the yaw angle from the start position.
I have a problem in calculating this since, say, the yaw angle will go from 0 to 360 degree. If the initial position is at 356 degree, I am not sure how to handle the data when the movement yaws to 1 again. If I use x-initialPosition metric, i will get 1-356, which is not the answer. Any suggestion?
This also applies to pitch that goes from 180 to -180

답변 (1개)

Guillaume
Guillaume 2016년 9월 27일
편집: Guillaume 2016년 9월 27일
mod(1-359, 360)
For pitch:
mod(pitch2 - pitch1 + 180, 360) - 180
  댓글 수: 4
Sharah
Sharah 2016년 9월 27일
no, i mean, the range of the yaw is 0 to 360. so if that start PointStart = 357, and Point2 = 3; the mod(3-357, 360) would work, which is 6.
however, let say the object rotates to the left, and Point3 is now = 351. instead of mod(351-357, 360) giving -6, the answer is now -354.
I'd like to find a way that can calculate these angle automatically without checking if they are negative or positive
Guillaume
Guillaume 2016년 9월 27일
편집: Guillaume 2016년 9월 27일
mod(351-387, 360) is 354 not -354. Note that -6 and 354 are the same angles (modulo 360).
As demonstrated (twice now), you perform you difference as usual. If you want to display it in the range [0,360[ you use
mod(difference, 360)
If you want to display it in the range [-180, 180[ you use
mod(difference + 180, 360) - 180
This is basic modular arithmetic

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Point Cloud Processing에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by