Skip to content

Instantly share code, notes, and snippets.

@rpavlik
Created August 31, 2015 16:25
Show Gist options
  • Save rpavlik/1866731eb2bc3a01f507 to your computer and use it in GitHub Desktop.
Save rpavlik/1866731eb2bc3a01f507 to your computer and use it in GitHub Desktop.
Conversion to a quaternion rate
// Given XYZ radians per second velocity.
q_from_euler(vel_quat, angVel[2] * vel_quat_dt, angVel[1] * vel_quat_dt,
angVel[0] * vel_quat_dt);
// Small angle approximation from exponential map
vel_quat[Q_X] = angVel[0] * 0.5 * vel_quat_dt;
vel_quat[Q_Y] = angVel[1] * 0.5 * vel_quat_dt;
vel_quat[Q_Z] = angVel[2] * 0.5 * vel_quat_dt;
vel_quat[Q_W] = 1.0;
q_normalize(vel_quat, vel_quat);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment