In most if not all motion controllers, there is a “motion complete” flag, i.e., the controller issues a “1” in this register when the motor has reached the desired setpoint angle.
I know it can be achieved in SimpleFOC by moving the motor and then checking continuously the angle and if it is smaller than a window parameters then this is considered as motion done.
This can also apply to speed mode, once the desired speed has reached.
Of course, only in closed loop.
Is it implemented already in the library?