Design and hardware-in-the-loop test of an active magnetic detumbling and pointing control based only on three-axis magnetometer data