# Robotic Arm Control

Robots have become important over a wide range of applications--from manufacturing, to surgery, to the handling of hazardous materials. Consequently, it's important to understand how they work, and what problems exist in designing effective robots. This project will address one of those problems: positional control.

One of a robot's functions is to move to a specified location or along a predetermined path so it can perform a task. Motion may consist of the robot itself moving, or of an articulated arm being actuated from a fixed pivot position. Here we want to consider the problem of controlling the motion of a very simple articulated arm--a two-segment arm that can move only in the x-y plane and pivots about the position x=0, y=0. A stepper motor M1 at (0,0) is attached to the first arm segment L1 and controls the angle of L1 with respect to the x-axis. A second stepper motor M2, afixed to the end of L1, is attached to a second arm segment L2 and controls its angle with respect to the x-axis. Each arm segment is 100 units long, for a total maximum extension of 200 units. Neither of the arm segments may move below the base, i.e., y = 0.

The objective is to devise a sequence of motor commands to move the tip of the second arm segment as far as possible along a prescribed channel. These commands will change the angles 1 and 2 as a function of time T as follows:

angle 1 = a1 + b1*(T-T0) + c1* (T-T0)2
angle 2 = a2 + b2*(T-T0) + c2* (T-T0)2

The coefficients a, b, c determine the behavior of each motor: a is the motor's starting angle, b is the linear rate of angular change, c is the "acceleration" of angular change. Each motor command begins at time T0 and will run for a duration of one time unit, i.e., the range of (T-T0) is 0--1.

INSTRUCTIONS:

After you click below to begin the experiment, you will be presented with the experiment's display screen. Click Begin/Clear. This will produce a horizontal channel (randomly selected) through which you must move the tip of arm 2. Before you can begin to program the motor action to carry this out, you must first place the tip of the arm inside the channel, preferable as far to the right (or left) as possible. Do this by selecting values for the two leading coefficients (the a's in the equations above). Then click Initialize. This will reset the angles of the motors accordingly. If the tip still does not fall within the channel, enter new values for the coefficients and click Initialize until it does. Now you are ready to program the motors.

Deduce what combination of coefficients will move the tip on a trajectory that remains in the channel. Your objective is to move the tip from one end of the channel to the other. When the coefficients have been entered, click on Run. The arm will move according to your "program" either for a duration of (T-T0) = 1, or until it runs into the channel wall. The arm will also stop if either of the arms hits the base (in black). To move the tip further along the channel, you will need another program segment. Click on Another segment. The a's will be automatically reset to the tip's current position. Enter a new combination of b's and c's. Start the motion for this new segment by clicking again on Run. Repeat this Another segment, Run sequence until you have successfully moved the tip to the opposite end of the channel.

Every time you run a new program segment, a segment counter is incremented. The object is to traverse the channel in the fewest number of segments. Clever programming can dramatically reduce the number of program segments. At any time you can click on Begin/Clear to restart the problem. The bad news is that each click generates a different channel.

There are three modes in which to operate the experiment:

1) Practice mode: There is no constraining channel. Use this mode to familiarize yourself with the behavior of the arm segments with respect to the programming parameters.
2) Easy mode: The constraining channel is relatively wide. Large arm-motion deviations can be accommodated.
3) Hard mode: The constraining channel is relatively narrow. Only small arm-motion deviations can be accommodated.

PROBLEMS:

1. Produce a sequence of motor commands to move the arm tip from one end to the other in the "easy" channel. Record the motor instructions for each program segment as you proceed. Capture the final image showing the complete arm tip trajectory using the "print screen" and "paste" procedure.

2. Carry out problem 1 again, this time using the "hard" channel.

3. This is a theoretical problem. Calculate and plot the minimum and maximum horizontal limits of motion for a two-segment arm as a function of channel height. Assume arm lengths of 100, an infinitesimal channel width, and no arm positions below y=0.

Begin the experiment: