Skip to content

Instantly share code, notes, and snippets.

@jdiez17
Created December 7, 2018 17:41
Show Gist options
  • Save jdiez17/dcba17ef2907441b811503a99274beeb to your computer and use it in GitHub Desktop.
Save jdiez17/dcba17ef2907441b811503a99274beeb to your computer and use it in GitHub Desktop.
function [yaw pitch roll] = quat2eul(q)
qs = q(1);
qx = q(2);
qy = q(3);
qz = q(4);
yaw = atan(2 * (qs * qx + qy * qz) / (1 - 2 * (qx^2 + qy^2)));
pitch = asin(2 * (qs * qy - qz * qx));
roll = atan(2 * (qs * qz + qx * qy) / (1 - 2 * (qy^2 + qz^2)));
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment