Low Pass Filter Servo Control
Closed this issue · 5 comments
The servo can't actually drive the system at full speed, or it will destroy itself. Add a low pass filter of some kind to not allow sudden changes.
Er, "Server" -> "Servo" in the title. Don't you want a real control system on "the servo", whatever it is?
Ugh, it's late.
The servo can kill itself if it was, say, commanded to one extreme and then the other in only one time step.
We don't actually know how to fix it correctly, but is seems clear that the servo board should do this check so that it's not actually possible to send dangerous messages to the board. A short low pass filter should make it much safer. It may also go away after testing if we feel confident, but at least for now we need something so we don't damage the roll control.
Now that I've thought about it a little:
We may only want to restrict total movement at a time, e.g.:
if (abs(last - next) > MAX_RATE) {
next = MAX_RATE //but in the right direction, you get the drift
}
And we will want to add to our control system testing criteria that it not overtax the servo. Really I expect the control system to behave sanely (probably a mistake ^.^) so that in practice this whole thing isn't an issue. But while we're testing we really don't want to violate this rule so it really should be at the microcontroller level.
This is effectively what's currently in the code, the problem is that it can oscillate between +MAX_RATE and -MAX_RATE a whole bunch really quickly, which is bad for the servo.
This was resolved in 98357d3 and related commits as a sort of quasi limit on the 0th, 1st, and 2nd derivatives, because it was easier to reason about that way.