Cogging compensation in embedded brushless motor control for haptics applications