RobotCasserole1736 / CasseroleLib

Common Libraries used year-to-year for FRC robot code
MIT License
6 stars 1 forks source link

Implement BangBang Controller #8

Open gerth2 opened 8 years ago

gerth2 commented 8 years ago

A Bang-Bang controller does the same job as a PID, but in a much simpler method. It doesn't work in all scenarios, but for the ones it does work in, it requires no tuning (woot!)

Reference #6 for details on how to implement the BangBang controller. It should have the same sort of interface as the PID - user instantiates a superclass of the BangBang class, and override the output/input classes.

As to how to write a bang-bang controller:

Controller should run in its own thread in the background (10 ms rate)

When input is below setpoint, output should be "1". When input is above setpoint, output should be "0".

That's it. No tune. Just set a setpoint. Works well for stuff like shooter wheels, horrible for position control or other stuff.