Adding a deadband to a PID loop

We are attempting to program our intake arm to 3-4 set positions using PID. The arm is powered by a RS775 on a PG188 and chain. From what I’ve been told, RS775’s don’t like to be stalled. After doing some searching on CD and looking at Team 358’s examples, it looks like adding a deadband to prevent stalling the motor while holding position might work. My questions are:

  1. Is adding a deadband the correct way to prevent stalling the motor while holding certain positions?

  2. Where do I add the deadband? On the setpoints? On the PID output?

Any help, examples, or screenshots would be greatly appreciated!

EDIT: Depending on the position, motor output is between 0.01 - 0.07 when the intake is holding position.

4242_periodic_tasks_PID.jpg
4242_teleop_ex.jpg


4242_periodic_tasks_PID.jpg
4242_teleop_ex.jpg

There are 3 RS775 motors. Which one are you using?

On a scale of 0 to 1, where 1 is 12 volts?

0.07 would be 0.84 volts. Unless the motor gets very hot during the climb, it should be able to stall at that voltage for a few seconds.

Thanks for the quick reply!

It’s not labeled, but I’m pretty sure it’s the 12V version as it came with the PG188 from Andymark. Our typical intake arm positions are resting on the floor, stowed / resting in the robot, and two others in-between (for placing the gear). The highest voltage is seen at the in-between positions (around 0.84), but the intake shouldn’t be there for more than 10 seconds at a time. However, when the intake is stowed, it shows an output of 0.03 (0.36 volts) and it could possibly be in this position for most of the match if we’re playing defense.

Is there no way to get it to zero?

If you are not applying any power to the motor, then it is not providing any torque to hold the arm in a static position. It’s that simple.

No amount of coding Fu will change that.

You could put the motor controller in brake mode, which would cause the motor to provide dynamic damping, but that’s not what you’re asking.

So unless you design your arm with a mechanical stop, or sufficient friction (like a high friction gearbox) to hold its position, it will move if the motor is not powered.

Try turning the motor power off once you’ve reached the desired position, then jostle the robot around to see if the arm stays put.

There’s a little slop in the mechanism, but the motor stays put.

RS775 motors can handle a low-power stall if given an active cooling system. There was an “Ice Cube” fan cooling system that came in the KOP a few years ago that was made for 775 and 550 size motors. If you don’t have one of those, you can put a fan on the motor, but make sure to use a duct and place the fan at least 2" from the motor magnets, otherwise the motor magnets interfere with the fan’s internal commutation (hall-effect sensors).

If the intake is at its lowest position or bottomed out just put a toggle that makes the motor speed 0 and doesn’t go through the PID.

We solved this issue by setting up some limit switches wired directly to the motor controller that cuts power to the motor when it’s all the way down or all the way stowed. It’s not as precise as the analog encoder but it seems to work. The intake arm is not kept in the in-between positions for very long, so it doesn’t appear to be an issue.