How to convert euler angle(roll pitch yaw) to position(x,y,z)
218 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
please how do i find position and orientation? thanks
yaw = 1;
pitch = 2;
roll = 3;
q = quaternion([yaw pitch roll],'eulerd','zyx','frame');
rotationmat= rotmat(q,'frame');
0 Kommentare
Antworten (1)
Meg Noah
am 17 Jan. 2020
Position is a separate measurement from roll, pitch, yaw. Position is the location of the entity, such as an aircraft. Typically it is expressed in geodetic coordinates (altitude, latitude, longitude), spherical earth coordinates (altitude, latitude, longitude), earth centered earth fixed aka earth centered rotating (ECEF) cartesian coordinates, or intertial earth centered (ECI) cartesian coordinates.
The roll, pitch, yaw vectors
The roll, pitch, yaw, and DCM (direction cosine matrix) depend a little on convention. This is one convention:
dcm = zeros(3,3);
dcm(1,1) = cosd(yaw)*cosd(pitch);
dcm(1,2) = cosd(yaw)*sind(pitch)*sind(roll) - sind(yaw)*cosd(roll);
dcm(1,3) = cosd(yaw)*sind(pitch)*cosd(roll) + sind(yaw)*sind(roll);
dcm(2,1) = sind(yaw)*cosd(pitch);
dcm(2,2) = sind(yaw)*sind(pitch)*sind(roll) + cosd(yaw)*cosd(roll);
dcm(2,3) = sind(yaw)*sind(pitch)*cosd(roll) - cosd(yaw)*sind(roll);
dcm(3,1) = -sind(pitch);
dcm(3,2) = cosd(pitch)*sind(roll);
dcm(3,3) = cosd(pitch)*cosd(roll);
But it isn't the only standard that is followed. Stengal follows a different convention, and his codes are available for download here:
dcm = zeros(3,3);
dcm(1,1) = cosd(pitch)*cosd(yaw);
dcm(1,2) = cosd(pitch)*sind(yaw);
dcm(1,3) = -sind(pitch);
dcm(2,1) = sind(roll)*sind(pitch)*cosd(yaw) - cosd(roll)*sind(yaw);
dcm(2,2) = sind(roll)*sind(pitch)*sind(yaw) + cosd(roll)*cosd(yaw);
dcm(2,3) = sind(roll)*cosd(pitch);
dcm(3,1) = cosd(roll)*sind(pitch)*cosd(yaw) + sind(roll)*sind(yaw);
dcm(3,2) = cosd(roll)*sind(pitch)*sind(yaw) - sind(roll)*cosd(yaw);
dcm(3,3) = cosd(roll)*cosd(pitch);
Matlab's example for their aerotoolbox allows you to select any convention with 'ZYX' | 'ZYZ' | 'ZXY' | 'ZXZ' | 'YXZ' | 'YXY' | 'YZX' | 'YZY' | 'XYZ' | 'XZY' | 'XYX' | 'XZX' options. This is their example:
yaw = 0.7854;
pitch = 0.1;
roll = 0;
dcm = angle2dcm( yaw, pitch, roll )
dcm =
0.7036 0.7036 -0.0998
-0.7071 0.7071 0
0.0706 0.0706 0.9950
The direction cosine matrix (dcm) maps the body coordinate system to the velocity/motion coordinate system. From this, you can get the aspect angle ('angle of attack') and sideslip angle.
[alpha, beta] = dcm2alphabeta(dcm)
The dcm can also be converted to a quaternion:
q = dcm2quat(dcm)
Any of these (Roll, Pitch, Yaw), DCM, (aspect, sideslip), and quaternion are expressions of the orientation (attitude) of the body at its position relative to its motion vector. The Roll, Pitch, Yaw can be any of those 12 different Euler conventions for applying three rotations on a cartesitan system.
So any of these ARE the orientation with respect to motion. They are independent of the position, and position is not acquired from them.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Earth and Planetary Science finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!