フィルターのクリア

Euler angle from 3d points?

30 ビュー (過去 30 日間)
SOONMYUN JANG
SOONMYUN JANG 2020 年 12 月 21 日
コメント済み: Rizwana Ahmad 2023 年 7 月 5 日
I want to compute Euler angle from 3d points which are in a same plane and nearly rectangle shape.
These 3d points are collected by robot arm. I want to know the correct rotation value of the plane for robot arm control.
I computed like below and I don't know how to convert three angles to Euler angles.
P1 = [-426159, 501913, 845131]
P2 = [-48717.2, 499318, 847679]
P3 = [-43057.3, 493773, 478609]
P4 = [-422845, 495153, 475314]
Z_angle = atan((P2(2) - P1(2)) / (P2(1) - P1(1))) * 180 / pi;
Y_angle = atan((P2(3) - P1(3)) / (P2(1) - P1(1))) * 180 / pi;
X_angle = atan((P1(3) - P4(3)) / (P1(2) - P4(2))) * 180 / pi;

採用された回答

Shashank Gupta
Shashank Gupta 2020 年 12 月 31 日
編集済み: Shashank Gupta 2021 年 1 月 7 日
Hi,
I think what you need to do is first convert these cartesian vectors to rotation matrix and then to Euler system. It is a simple Geometry. Below is the brief code for the reference.
% Lets take first 2 points and find Spherical coordinates.
P1 = [-426159, 501913, 845131];
P2 = [-48717.2, 499318, 847679];
v = P1-P2;
% Let's define si and theta in such a way that.
v = [r*cos(si)*cos(theta), r*sin(theta), r*sin(si)*cos(theta)]
r = norm(v);
si = atan2(v(3),v(1));
theta = atan2(v(2),sqrt(v(1).^2+v(3).^2));
j = [cos(si)*cos(theta), sin(theta), sin(si)*cos(theta)];
% Correspond to j vector you can also find orthonormal vector to j
i = [sin(si), 0, -cos(si)];
k = [cos(si)*sin(theta), -cos(theta), sin(si)*sin(theta)];
% Rotation matrix;
m = [i',j',k'];
% You can use MATLAB inbuilt function to convert rotation matrix to Euler system
eul = rotm2eul(m);
This is the typical geometrical way of doing it, There could be more ways, For reference check out vrrotvec, vrrotvec2mat and cart2sph These function can also make your calculation easy.
Cheers
  2 件のコメント
SOONMYUN JANG
SOONMYUN JANG 2021 年 1 月 4 日
Thank you so much!
Rizwana Ahmad
Rizwana Ahmad 2023 年 7 月 5 日
Hi Shashank,
I am bit confused about step 4,5 and 6 as they seem inter depdndent. we cant calculate 4th without knowing 5th and 6th, pls correct me if I am wrong.
v = [r*cos(si)*cos(theta), r*sin(theta), r*sin(si)*cos(theta)]
r = norm(v);
si = atan2(v(3),v(1));

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCoordinate Transformations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by