How are arms programmed?

There seem to be a lot of really nice arms on 2018 robots, and I was wondering how teams control the arms. Also for arms with 2 pivots, how do teams stabilize the wrist joint so it is always parallel to the ground?

Thanks :slight_smile:

Arms are typically controlled with a closed-loop control system. There are numerous ways of doing it, but one of the most common is called a PID controller. A way I like to explain it is a thermostat. It uses to the control loop to get the process variable (the value being measured) to reach a desired state or setpoint. It simply turns on and off repeatedly to achieve this. That controller is known as a bang-bang controller. In an arm, you use a sensor such as an encoder to measure the angle of the arm. The control loop calculates the error and the motor voltages needed to get rid of the error and maintain the setpoint. I would suggest looking up PID and understanding the concept. Once you get a hang of it you can look up motion profiling, which is a more advanced method of control. The Talon SRX speed controller can abstract a lot of this for you, so you can look at its documentation. Though, it would still be good to have an understanding first.

Your problem of keeping the arm parallel can be achieved mechanically using a 4 bar linkage (or other ones). Though, you can also achieve it through software.

Keep in mind, you need to size your system correctly for the control loops to work, enough torque, speed, etc.

There is a paper that explains PID very well located here:

In addition, Wikipedia has some very helpful pseudocode in their article (in the Pseudo Code section) - it’s how I originally learned to program a PID.

The TalonSRX’s that we like to use have the PID functions built in. You simply need to connect a sensor, set the paramters correctly, and it takes care of the math for you.

The key point to controlling an arm without overworking your motors (and likely having undesired shaking) is having some sort of counter load - a counter spring or counter weight. Then, make sure that what torque you are applying is not being pushed through too small a shaft - for arms, dead axles and sprockets/pulleys fixed to the arm spread the load out.

Keeping things parallel: the parallel 4-bar. Make a quadrilateral with hinges/pins on the corners such that both pairs of opposite sides are the same length, and those sides will remain parallel. Then fix one of those to your (horizontal) chassis, and the top part remains horizontal as well!

In 2015 our arm and wrist were kept parallel by 2 PID controllers. We always controlled the arm by feeding a set point to the shoulder. We took the actual position of the shoulder joint to calculate a parallel angle and then fed it in to the wrist PID. The wrist lagged the shoulder by several degrees but it wasn’t notice able enough to matter. You can see this in action at the 25 second mark in

Fast forward to 2018. Our arm utilized Motion Magic on both joints. As GeeTwo stated a counter load (spring) was key to making the arm controllable. Our arm required force to stay all the way down. It naturally wanted to float about level. We controlled the arm by enforcing max dimensions per the game manual. When ever we command the arm we command a pivot angle and a max extension. The pivot set point was fed directly to the pivot and the extension set point was the lesser of the max extension desired and the max legal extension given the angle of the pivot. You can see this in action here.