A. Initialization
For initialization, we determine the initial attitude o0 of the
phone, while it is not moving using the accelerometer. We estimate
gravity g from N accelerometer measurements, while the
phone is not moving, which gives us a reliable estimate of our
initial attitude o0 (up to a rotation about the vertical axis). During
the implementation of the system, we experimented with different
values for N and found that N = 10 is a suitable choice.
This means that the initialization only takes a fraction of a second,
and it is a good compromise between a stable estimate for
gravity and waiting for the initialization.