A magnetometer-only attitude determination strategy for small satellites: design of the algorithm and hardware-in-the-loop testing