Here is how to implement a stepper motor to sense position and actively correct any error that might accrue during actuation.
A high-performance, easy-to-use servo motor control library for Raspberry Pi Pico with smooth motion control and hardware PWM support.