# Programming 2 potentiometers?

Our robot has an arm, and a joint which both have a potentiometer. Attached to the arm is a claw. But since a normal arm changes the angle of the claw we were wondering if there is a way to program our arm and joint so when the arm raises the joint will rotate keeping our claw at the same angle as if it was down. So basically we are wondering if there is a way for our arm to raise, while our joint rotates to keep the claw at the same position.

You’ll first have to find the “relation” between the two pivots.

For a certain angle (pot value) of the arm, there will be an angle for the pivot on the claw so that the claw will be parallel to the ground (assuming that’s what you mean by “as if it was down”). So you’ll find a few pairs of coordinates (x = the input, which is the “arm”, y = the output, which is the angle of the pivot of the claw), and find an equation for it by either using a graphing calculator / excel.

Once you find the equation, then you will know the “target” value (what the angle of the claw pivot is supposed to be). The value will update itself when you move the arm up / down because it’s independent variable (x) is the pot value of the arm. Then you can program the claw pivot to move one way if the current position is bigger than the target value, and move the other way if is less.

And you’d want it in an infinite loop so it keeps updating the value.

It should be very rare that you would need to do this. Even if you can’t build a 4-bar because of space constraints, this arrangement still works well:

The two axles are fixed (one to the tower and one to the claw), so the claw is kept at a constant angle relative to the tower. Yes, you can do it with potentiometers and you will need to if you have a need to control the claw angle and arm angle separately, but it’ll almost always be a waste of motors.

I was going to suggest the same thing. The chain and sprocket idea. It works great. The robot my team is prototyping now uses it and its pretty nice.

And at Vex Mundi,
If this set up uses only 1 bar, why dont more teams use it? In place of a 4 bar or 6 bar or whatever. Ive known about it for a little while and dont know why teams wouldnt use it to make a lighter robot. Its possible I could just be missing something though.

If you don’t want to do the chain and sprocket idea, the two potentiometer also works well. Sometimes you cannot do the chain and sprocket, because you may want to keep the claw straight and also have the option of moving it independently. Our team has done this is the past, and it works quite nicely. If you’re using ROBOTC, the code can look something like this:

``````motor[clawSraight] =
(((SensorValue[armPot] * ratioOfArmRotationToClawRotation)
+ differenceInStartValue) - SensorValue[clawPot])
* ratioOfErrorToMovement``````

This code makes the motor power proportional to the two pots, and makes for very smooth and accurate motion. If you just say: move up when the pots show x difference, move down when the pots show -x difference, or do nothing, then the movement will be jerky, and probably not as accurate. The proportional code also puts less wear on your motors.

It’s good for a fast claw, but I think if you want to pick up multiple objects or you want a more robust robot then a parallelogram linkage is probably a better idea.

We currently have this chain arrangement on our robot for driver skills because it’s designed to be very fast and score two objects at a time. We haven’t put it on a tournament robot because it isn’t compatible with the intakes we’ve built, which are heavier and more capacious than simple claws.

Using chain to make a linkage is awesome in Vex. You can make some really cool motions.