Apologies for the double post but this conundrum that has started to consume an annoying amount of my development time/effort.
When I started re-writing AAPO's LM flight control code I used elements of Darrenc's Simplex-based thruster control project. However as I began to model some of the more esoteric components of LM flight control (SAS modes, thruster 'Pulses', and thruster count) things quickly got out of hand. As Such I find myself going back to the drawing-board.
What I need is a function/algorithm that will take a desired torque vector in n-meters, force vector in newtons, and a desired number of thrusters to be used And select the optimal thrusters for the job and required throttle settings.
I've already got code that creates a table of available thrusters along with their torque and force vectors that I adapted from darrenc's. What I need are ideas of ways to consult that table and quickly arrive at the optimal thruster firing solution for the given inputs
Constraints:
Any suggestions/ideas would be greatly appreciated
When I started re-writing AAPO's LM flight control code I used elements of Darrenc's Simplex-based thruster control project. However as I began to model some of the more esoteric components of LM flight control (SAS modes, thruster 'Pulses', and thruster count) things quickly got out of hand. As Such I find myself going back to the drawing-board.
What I need is a function/algorithm that will take a desired torque vector in n-meters, force vector in newtons, and a desired number of thrusters to be used And select the optimal thrusters for the job and required throttle settings.
I've already got code that creates a table of available thrusters along with their torque and force vectors that I adapted from darrenc's. What I need are ideas of ways to consult that table and quickly arrive at the optimal thruster firing solution for the given inputs
Constraints:
- Use thrusters contained in provided table.
- Returned throttle settings must fall between 0.0 and 1.0
- If exact solution is impossible (insufficient thrust) get "next best" with focus on matching vector direction rather than magnitude
- number of thrusters utilized in the solution must be <= number of thrusters designated in the input.
- Minimal iterations/number crunching, this function may be called multiple times per timestep.
Any suggestions/ideas would be greatly appreciated