A gyroscope measures the angular rate around the three axis , and of the sensor frame named , and respectively. By integrating this angular rate, it is theoretically possible to estimate the orientation over time. Let’s define the vector :

Where , and are expressed in rad/s.

Let’s now consider the quaternion derivative that describes the rate of change of orientation:

Where :

is the derivative at time step expressed in the quaternion space.

is the estimated orientation at time step .

By integrating the quaternion derivative it becomes possible to estimate the orientation over time:

Note that for some applications, the quaternion must be normalized after integration: