Skip to content

Instantly share code, notes, and snippets.

Avatar

Sebastian sroettgermann

  • Geldern, Germany
View GitHub Profile
@sroettgermann
sroettgermann / quat2euler.m
Created Oct 5, 2018
matlab function to convert quaternion to euler angles
View quat2euler.m
function [phi_,theta_,psi_] = quat2euler(measurement_)
qw = measurement_.quat_w;
qx = measurement_.quat_x;
qy = measurement_.quat_y;
qz = measurement_.quat_z;
% roll - phi
sinr = 2 * (qw .* qx + qy .* qz);
cosr = 1 - 2 * (qx.^2 + qy.^2);
phi_ = atan2(sinr,cosr);
You can’t perform that action at this time.