Here is how to implement a stepper motor to sense position and actively correct any error that might accrue during actuation.
The types of diagnostic measures that use watchdog timers as recommended by the IEC61508-2 standard to address failures in program sequence.