LEGO MINDSTORMS Robot Inventor
Ring Stacker
This robot arm can rotate 180 degrees, lift up and down, and open and close its claw to pick up, move, and stack the four colored rings.
The programs provided make the robot solve the classic Towers of Hanoi puzzle, which involves moving a stack of rings from one pole to another, with one spare temporary pole to use. The problem is, the rings are different sizes and stacked in decreasing size, and the rule is that you cannot stack a larger ring on top of a smaller ring. So, the solution is not trivial or immediately obvious. The programs provided (both Word Blocks and Python versions) solve the puzzle using the classic recursive algorithm to this puzzle and then make the arm execute all the necessary moves.
For a 4-motor version of this design that adds another axis of motion, see the 4-Motor Arm.
Programming
Both of these programs solve the Towers of Hanoi puzzle using the classic recursive algorithm.
The starting position for the robot is with the four rings stacked on the left pole, and the robot arm must be centered on the center pole (use the motor knobs to adjust the position manually before starting the program).
Understanding the Program
The Word Blocks and Python programs both solve the puzzle and operate the arm in the same way, just in two different programming languages.
The recursive algorithm will probably be difficult to understand unless you have a college-level computer science background. To help understand the solution better, in the Word Blocks version, you could replace the main program start sequence and the MoveStack MyBlock below it with the main program start sequence shown in the "MoveRing Sequence" image above, which executes a series of pre-planned 15 single-ring moves. This sequence of moves is the same sequence that the recursive MoveStack block computes, but just listed directly instead of computed.