How to calculate roll, pitch and yaw from XYZ coordinates of 3 planar points?

조회 수: 411 (최근 30일)
I have a body moving through a calibrated space. The body has 3 co-planar points on it. I know the global x, y and z coordinates of each of those points.
How can I calculate the roll, pitch and yaw angles of the plane on the body?
Thanks, Sophia
  댓글 수: 5
T
T 2016년 8월 9일
The body-fixed XYZ-axes are represented by the red, blue and green lines in the image. All three points lie on the XY plane (assuming Roll axis (red) is X and pitch axis (blue) is Y). The points form a 2.2mm equilateral triangle. P1 is forward left, P2 is forward right and P3 is the rearmost point on the body (points are ordered clockwise). The direction of the axis perpendicular to the plane should be up or away from the body.
Is this information sufficient to resolve my problem?
Arash Jouybari
Arash Jouybari 2017년 2월 12일
Hi Sophia S I exactly want to know about your GPS antenna configuration... and I didn't understand about body-fixed axis that Dhruvesh Patel said.
I have your problem as you wrote above. arash.joybari@gmail.com this is my email plaese help me to solve my problem.
thanks

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

채택된 답변

Dhruvesh Patel
Dhruvesh Patel 2016년 8월 10일
I assume that you are following Euler Angle convention of roll-pitch-yaw in the order of X-Y-Z. You have three coplanar points P1, P2 and P3 on the body in clockwise order (looking from the top) and that the X-axis of the body-fixed frame can be taken along the vector starting from P3 passing through the midpoint of the segment joining P2 and P3 i.e., x = (P1+P2)/2 -P3.
First we need to obtain the unit vectors along the XYZ-axes of the body-fixed frame. To do this:
  1. Construct vectors v1=P2-P1 and v2=P3-P1.
  2. Now Z is along the vector cross(v1,v2). Normalize it to get the unit vector Z.
  3. The unit vector (X), along X-axis is obtained by normalizing the vector x obtained above.
  4. Unit vector (Y) along Y-axis can be obtained as cross(Z,X). This will be a unit vector as Z and X are unit vectors.
Now, the Rotation Matrix representing the orientation of the body-fixed frame can be written as R=[X1,Y1,Z1; X2,Y2,Z2; X3,Y3,Z3], where X=[X1; X2; X3;] and so on for Y and Z. Assuming roll, pitch and yaw angles are called alpha, beta and gamma respectively. These can be obtained as:
  • alpha= atan2(-Z2, Z3)
  • beta= asin(Z1)
  • gamma = atan2(-Y1,X1)
I hope this is what you were looking for. More about Euler angles and finding them from rotation matrix, can be found here. If you have access to MATLAB's Robotic System Toolbox, you can use rotm2eul function to get Euler Angles from rotation matrix.
  댓글 수: 3
Justin Boyd
Justin Boyd 2020년 4월 8일
For this part:
R=[X1,Y1,Z1; X2,Y2,Z2; X3,Y3,Z3],
What is X1, Y1 Z1 - the xyz components of point 1?
Thanks
alper yeldan
alper yeldan 2021년 9월 5일
@Justin Boyd He put unit vectors(column vector) side by side to get thr rotation matrix. This one is XYZ rotation matrix. In wikipedia it explains how to construct the rotation matrix @Dhruvesh Patel is doing the exact same thing.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Cartesian Coordinate System Conversion에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by