Euler angle from 3d points?
24 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
SOONMYUN JANG
il 21 Dic 2020
Commentato: Rizwana Ahmad
il 5 Lug 2023
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;
0 Commenti
Risposta accettata
Shashank Gupta
il 31 Dic 2020
Modificato: Shashank Gupta
il 7 Gen 2021
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 Commenti
Rizwana Ahmad
il 5 Lug 2023
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));
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!