So I have a spaceship and I have 6 degrees of freedom.
At a given moment the following vectors are known of the spaceship:
- Local forward.
- Local up.
- Local sideways (may be implied from the previous two).
- Angular momentum.
The spaceship has 3 torquers to add/subtract to the angular momentum the in main directions relative to it.
Each of them can add 0 to 1 units of angular momentum per second (so it's possible to run them less than full power when needed).
So from the given vectors, how can I compute which torquers to run to lock on the target vector as quickly as possible?
I think this is a basic problem in the field of attitude control. But I couldn't find good pointers yet (maybe I didn't use the right keywords in my search).
The tricky part is that I want to consider the instantaneous angular momentum. Otherwise I would just cross multiply the forward vector and the desired direction vector to have the desired axis of rotation, but that's not what I'm looking for...
My current idea is the following: use the roll torquers to eliminate the roll component the spaceship rotation if any, while using the pitch/yaw torquers to rotate it into the direction based on pitch/yaw angular differences of the forward and the desired direction and the pitch/yaw component of the spin. But I'm not sure it's the quickest, might not even be correct.