Control algorithms are used on spacecraft to operate reaction wheels, RCS thrusters and other actuators. Since of the most common controllers I've come across are the PID and quaternion error command. What are the parameters that are accounted for when selecting a spacecraft attitude controller? How is the trade off carried out between different controllers and how are they optimized?
I'm an aerospace engineer, and took courses in college on spacecraft navigation and control theory. However, I have not programmed a spacecraft attitude controller in my work, and I can't say I've heard of a "Quaternion Error Command" controller before.
That said, these are the considerations I'd have off the top of my head when selecting a controller:
is the controller already known? There's a lot of heritage around, and if we're in a decent-sized firm we may already have experts in some controller type. The time and money savings resulting are not to be overlooked.
is the controller stable? Is it provably stable, given expected disturbances and the control and environmental models you have for your spacecraft? Spacecraft attitude control almost always requires fuel, and where it doesn't it requires power and tends to saturate. Stability was one of the primary concerns of the Controls class we took.
what kind of feedback does the controller need? (it's presumably closed-loop) Can your spacecraft hardware provide sufficient fidelity of feedback to retain the stability?
does the controller run in the hardware constraints you have in place? Does it still run with the rest of the software you need to run for the spacecraft to do anything?
For further reading on the trade studies I'd immediately turn to "Spacecraft Mission Analaysis and Design," but my copy is at work.
"How are they optimized" is really a whole other question, which depends on the controller you've selected. In practice it's application of theory followed by repeated tweaking of the controller parameters in response to simulation and (if you're lucky) flight data.