A survey of attitude sensors for spacecraft