After being initialized, the pHAT’s Python driver does not return correct position of a servo until that servo is moved.
Here’s a minimal working example showing the anomaly:
import pi_servo_hat
drv = pi_servo_hat.PiServoHat()
drv.restart()
print(drv.get_servo_position(0, 180)) # prints: 3420.0 (Incorrect!)
drv.move_servo_position(0, 90, 180)
print(drv.get_servo_position(0, 180)) # prints: 89.82421875000004 (Correct)
Why is this an issue? Getting proper servo position is important in many if not all applications. Without the ability to establish the initial position, the only workaround is to move the servo blindly. Not knowing from where the motion originates precludes easing (i.e., interpolating motion to be smoother) from being implemented. That in turn results in unstable behavior of the physical assembly which can contain multiple servos and can often be delicate.