Bang Bang Control, motors, and transmissions

Like many people with a whole lot of college classes, I know an awful lot of theory, and am lacking a lot of practical knowledge.

I implemented a minimum-time control loop for vision-based orientation control. Basically, use vision to see where you are with respect to the goal, and then use the controller, with the gyroscope as feedback, to move to the position determined by the goal. In testing it worked great. We didn’t finish it in time to include it in competition, but we might do some off season work to perfect it.

The problem is that I’m a bit worried about what it will do to the motors and/or transmissions with repeated use. The bang-bang controller used for the project switches between full forward (+1) and full reverse (-1) instantly. I know the big problem with bang-bang control is that not all mechanical components tolerate that sort of sudden reversal very well. If I do a lot more testing on it, am I likely to destroy the transmissions or motors?

I’m sure it depends partly on the components themselves. I’m sure some can hold up to that kind of abuse, and some cannot. Unfortunately, now I hit the limits of my knowledge. Is there any way to know, in advance, which ones are more likely to have issues? Can I look at the specs on a Toughbox at AndyMark and see something that will tell me about durability when used with a bang-bang controller?

 I'm guessing that the motors themselves are less likely to have a problem, but once again I don't really know that.  I just know that when I read about bang-bang control, there's always a caution that says they can be damaging to components.  I just don't know how to know, in advance, which ones are more likely to hold up, and which ones will be reduced to ballast by the end of a district match.  Is there any way other than destructive testing to figure out what are the limits of these components?

Why not include some sort of ramping? Alter the code so that the closer you are to the set point, the slower you go. We did this with our vision and rotation to angles code and it works fine.

Like jreneew2 says, converting from pure Bang-Bang to using a loop that adds some proportional logic to the controller is one path. That is attractive, because it better matches the controller with the sophistication available in the plant/robot.

Another place to insert ramping would be to leave the Banging alone, but put something (software or physical) between the controller and the “plant” that would “soften” the bangs. When your plant is an FRC robot, this is usually pretty easy to do. This is attractive because it can protect the plant/robot from all controllers.

A software approach is inserting ramping code between the Bang-Bang controller and the motor controller (subsystems) that prevents large changes in the stresses experienced by the electronics and moving parts. The Banger would still be requesting +/-1 (or zero?), but what would get passed to the controlled equipment would be the lesser of the Banger’s output, and the current_drive_signal_plus_or_minus_a_greatest_desired_change_per_update_cycle.

Of course, because either of these ramping changes affects the system’s behavior, you might need to reapply some of that theory you mentioned, using new approximations.

And, of course, the change I outlined could also affect how the plant (the robot) responds to all control signals (such as those from a human driver), depending on how/where the software is modified.

Blake

Given the duty cycle and lifespan of an FRC robot, bang-bang controllers are totally appropriate in many applications. In an industrial setting, I might worry about shortening mechanical lifespans, but in FRC that may not apply depending on the application.

And in a drive train, the inertia of your robot will effectively smooth out your controls for you whether you like it or not.

Ramping, softening the banging, any of those various solutions are possible. The question is are they necessary at all?

I used the Bang-Bang, and it works, and the robot still drove afterwards. The only modification I made is that I found the +/- 1 didn’t respond fast enough. There was overshoot. So as it got closer, I would ramp down to +/- .5, and then +/- .3. It still worked really nicely. I could achieve +/- 1 degree accuracy within about 200 milliseconds. It was a good deal faster than my PID implementations, and generally more accurate.

However, I only ran it through a few trials. I executed it maybe 20 times. If we were to use it in a match, it would happen several times in each match.

If I ramp it down, I’ll likely lose a bit of performance. Do I need to? Can those CIMs and Toughboxes take it, or is there any way to know, other than trying it, find out, and have some money in the budget for replacement Toughboxes if it turns out that the answer is they aren’t rugged enough?

And even with PIDs, the issue could still come up. If you have a significant value of D, sensor noise can can cause that derivative to change quite rapidly, resulting in some sign changes, sometimes with fairly high magnitude. Will that take a toll? There are, of course, ways to combat that as well.

However, to reiterate, the question is not what can be done about it, but rather whether anything needs to be done about it? I was an EE, so I never got to properties of different sorts of metal gears. I’m wondering if there are any guidelines or ways of predicting what is and isn’t safe to throw at a motor or transmission.

Thanks. I wrote my last reply while you were writing yours.

As to the last point, I suspected as much, and that is why I felt fairly safe I wasn’t about to turn my transmissions into dust, but I didn’t have much confidence in my own assessment.

In general, it is not good for the motors to go from full forward to full reverse. However, for one more competition, you probably will not notice it.

Another option is to change your motor controllers. I am guessing they are currently in “coast” mode. That means the motors are free to spin when no command is being applied.

If you switch to “brake” mode, the motor controllers will resist the movement of the motors. What that does for you is that instead of full forward/backwards, you can go full forward/0. Let the motor controllers deal with slowing the motor. I am not sure if that is any better for the motor.

Yeah, sorry for jumping ahead to suggesting a way to be more gentle.

To answer your specific question, you can do some heinous calculations (an expert might not think they are heinous), using wisely chosen approximations, and the result will be an estimate (possibly accompanied by a probability distribution).

Being gentle delays the inevitable, and keeping spare parts handy is a way to reduce the effects of a failure…

I’ll bet the consensus from us folks in the CD peanut gallery will be a recommendation to invest a little time in examining the parts occasionally to see if they are showing any obvious signs of trouble (broken teeth, sloppy bearings, etc.), having a backup plan just in case your luck runs out before you are finished using the robot, and a guess that your luck won’t run out if you only attend one more tournament (that would be a guess that you are probably using parts that will survive, even though we don’t know what those parts are :)).

Blake

That sounds like the wisest course of action. Do a semi-destructive test, with frequent inspections. I plan on doing some off season training, for myself and for students. I’ll invest a couple of bucks (ok, a couple of hundred before I’m through. A pretty penny, but knowledge is worth its weight in gold, right?) in some transmissions that I can then put through paces, and see if the ones that got thrown into the bang-bang controller fare any worse than their PID counterparts.