This project makes use of encoder motors to control the shaft position of the motor. The home position is set by stalling the motor rotation for 2 seconds. The motor can then move to a desired angle relative to the home position.
Demo video: https://www.youtube.com/watch?v=X-KnnAx4Ez0
This video demonstrates if the motor is stalled for less than 2 seconds, the program will not set the home position and the motor will continue to spin, waiting to be stalled. Once the motor was stalled for more than 2 seconds, the motor rotates exactly 180deg to demostrate moving relative to the home position.