01/15/2007: Programming the LEGO Mindstorms NXT robot arm was easy. Getting the steps (and power settings) sufficient so that the clamps would grasp the ball without grasping the platform, and releasing the ball cleanly, took a bit of trial-and-error.
If you activate the clamps the moment the contact sensor is pressed, the clamps will grasp the platform and this will result in a fumble. The robot will drop the ball.
When the contact sensor is pressed, you need to move the robot arm upward–rotate the z-axis servomotor 9 rotations. This allows the clamps to grasp the ball cleanly.
Once the clamps grasp the ball, I rotate the z-axis servomotor an additional 5 rotations. This allows the robot arm and clamps to clear the platform.
Then, I rotate the x-y axis servomotor 15 rotations.
Once that is done, I rotate the z-axis servo down 5 rotations. Then, I release the ball onto the platform by activating the servomotor that controls the clamps.
Then, I rotate the z-axis servomotor upward 5 rotations.
Finally, I rotate the x-y servomotor 15 rotations, back to its original position.
Here is the robot and program: