I'm not sure whether I should be putting this in the Math forum or here but I need help with rotation matrices.
My vessel Is a tail-sitter, it's axis of thrust is aligned with the y axis rather than the z. This has lead to various issues when it comes to autopilots and other functions having to do with vessel orientation.
A little ways back I developed a simple function that used the cross product of a target vector and my thrust vector to align my engine for a burn. This works fine for simple orbital manuevers (turning prograde Retro etc...) but is proving impractical for things like landing and ascent APs.
Therefore i'm back at the drawing board.
There are two problems with my initial approach.
* The first is that it does not acount for rotation that is around the axis of thrust. This would be roll in a standard orbiter vessel and yaw in mine. In orbit this is no big deal, (after all who cares if you are up-side-down as long as you're thrusting in the correct direction?) but it becomes problematic closer to the ground.
* The second is the one that's giving me headaches. You see, there are points in both the Ascent and Landing autopilot programs where the vessel's commanded pitch and roll approach or excede +/- 90 degrees and as a result Roll inputs become Yaw, trig functions start coming back undefined and the whole thing falls apart. My solution so far has been to strictly limit AP inputs whenever a problem angle approaches 90 but this is hardly an ideal solution, and introduces it's own problems. (For instance my Ascent autopilot is incapable of maintaining a VACC <= 0)
What I need is a way to define my orientation around arbitrary vectors indipendantly of the the standard Pitch, Roll, Yaw axise.
In other word I need a matrix.
Unfortunatly i'ts been a while since I messed with matrices and I am unclear about how how to go about finding what I want.
In general terms, what combination of pitch roll and yaw inputs do I need to make to produce an arbitrary rotation around an arbitrary axis?
Likewise how do I go about decomposing my global orientation into something I can actually use for navigation? (i.e pitch up and hold 100 degrees)
My vessel Is a tail-sitter, it's axis of thrust is aligned with the y axis rather than the z. This has lead to various issues when it comes to autopilots and other functions having to do with vessel orientation.
A little ways back I developed a simple function that used the cross product of a target vector and my thrust vector to align my engine for a burn. This works fine for simple orbital manuevers (turning prograde Retro etc...) but is proving impractical for things like landing and ascent APs.
Therefore i'm back at the drawing board.
There are two problems with my initial approach.
* The first is that it does not acount for rotation that is around the axis of thrust. This would be roll in a standard orbiter vessel and yaw in mine. In orbit this is no big deal, (after all who cares if you are up-side-down as long as you're thrusting in the correct direction?) but it becomes problematic closer to the ground.
* The second is the one that's giving me headaches. You see, there are points in both the Ascent and Landing autopilot programs where the vessel's commanded pitch and roll approach or excede +/- 90 degrees and as a result Roll inputs become Yaw, trig functions start coming back undefined and the whole thing falls apart. My solution so far has been to strictly limit AP inputs whenever a problem angle approaches 90 but this is hardly an ideal solution, and introduces it's own problems. (For instance my Ascent autopilot is incapable of maintaining a VACC <= 0)
What I need is a way to define my orientation around arbitrary vectors indipendantly of the the standard Pitch, Roll, Yaw axise.
In other word I need a matrix.
Unfortunatly i'ts been a while since I messed with matrices and I am unclear about how how to go about finding what I want.
In general terms, what combination of pitch roll and yaw inputs do I need to make to produce an arbitrary rotation around an arbitrary axis?
Likewise how do I go about decomposing my global orientation into something I can actually use for navigation? (i.e pitch up and hold 100 degrees)