Arm setpoints

What is a good way to go about controlling an arm to move to preset angles? There are three positions we would like it to go to. We have considered limit switches, encoders, and potentiometers. If it helps, we are using victor SPX’s and are programming in command based python.

I would recommend using an encoder and a limit switch at the 0 position directly connected to the talonSRX, this will give you the following advantages:

  1. Resetting the encoder position based on the limit switch triggering, so the encoder position will be relative to the 0 degree of the start position.

  2. Using close loop to control the position.

  3. If needed, adding a second limit switch at the opposite side and stop the arm from tying to pass the mechanism limit from both sides.

All of those can be accomplished by using the talonSRX API

1 Like

You will certainly need a feedback mechanism to know where the arm is at currently. All the items you listed are at least somewhat viable. I would personally prefer a nice robust potentiometer.

As far as programming, that depends on what feedback mechanism you choose. The fundamental logic is to have variables describing desired_position and actual_position. The driver commands a desired_position. The code then chooses a motor velocity which causes actual_position to get closer to desired_position.

What model of potentiometer would you reccomend?

There’s a lot of options… what is the rotational range of your arm? How many degrees can it rotate through? Also, if you had one, do you have any constraints on how you want to mount it?

The biggest thing is probably physically mounting, and making sure it’s got the physical rotation to match your mechanism. Most “1-turn” models go at least 250 degrees or so, multi-turn can go further. You want the smallest number of turns that can fit your mechanism. See this digikey search for some ideas - I’d think most of these would work fine, though it depends on exact application.

Andymark also sells this one that is pretty good in most applications, though 10-turns may be a bit of overkill for the arm.

I would recommend using encoder with switch to reset it at 0 pos, this will compensate for any error accumulated while moving the arm. Also, encoders have no limit and have better resolution.

Everyone’s recommendations regarding limit switch at 0 and potentiometers or encoders is exactly as I would suggest. One other thing that I would mention though is that these sensors are only as good as your mechanism works mechanically. I might be getting at something that has already been addressed but I figured I should post anyways for future readers:

Essentially, I would suggest making sure there is little backlash between the arm and the shaft which it rotates on. Also, make sure that you do not need to stall the motor just to hold the arm in place for long periods of time. To accomplish this you can use a brake of some sort or some counter forces such as counterweight or springs. Often for elevators, constant force springs are used (see Grey Elevator) to help keep the elevator stationary as the height varies.

TLDR: Make sure your arm stays close to the right position without PID before trying to program it to stay still otherwise it will flap back and forth endlessly and/or create magic smoke.