Skip to content

Instantly share code, notes, and snippets.

View sroettgermann's full-sized avatar
💻
experiencing new worlds ...

Sebastian Röttgermann sroettgermann

💻
experiencing new worlds ...
View GitHub Profile
@sroettgermann
sroettgermann / quat2euler.m
Created October 5, 2018 14:01
matlab function to convert quaternion to euler angles
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);