Teaching the robot arm
Now we jump off the deep end and start writing some code.
We can begin by talking about how we send commands to the arm. The motors I have selected for TinMan are stronger versions of standard hobby servo motors, with metal gears. Servo motors are commanded by setting an angle for the motor’s output shaft to assume. The angles run from 0 to 180 degrees. However, the commands for the motor positions run from 1 to 255, so they fit into a single 8-bit value. We’ll be converting these byte-based motor commands to and from angles in the program.
Version one – action state reinforcement learning
Our first version of the arm training program will introduce the basic framework, and use the most primitive form of machine learning, which is to just try random movements until the program finds something that works.
Note
You must keep in mind that a particular arm position may have several valid solutions in our combination of three motors. For example, motor 1 may have slightly...