psas / stm32

PSAS STM32F4xx firmware development.
30 stars 20 forks source link

Low Pass Filter Servo Control #15

Closed natronics closed 10 years ago

natronics commented 10 years ago

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.

BartMassey commented 10 years ago

Er, "Server" -> "Servo" in the title. Don't you want a real control system on "the servo", whatever it is?

natronics commented 10 years ago

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.

natronics commented 10 years ago

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.

ThirteenFish commented 10 years ago

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.

ThirteenFish commented 10 years ago

This was resolved in 98357d3b3980a39ebecf6f1db3345e81ab25e0ea 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.