Hello,
I’ve developed an autopilot system that takes care of a craft’s thrust, roll, pitch, and yaw. It works pretty well. However, if I want the roll to be anything other than flat, this introduces a significant issue:
If the craft is, for example, yawed 45 degrees away from the direction it should be, and also rolled 90 degrees, then the system detects it must yaw when really it must pitch (relative to craft).
I have worked with two (very similar) systems while trying to get around this – if anyone has an answer that works for either of them, I would be ecstatic:
or
Thanks!
I’ve seen some promising info when looking at linear algebra rotational transformation matrixes, but wouldn’t know how to implement that in blueprints.
Anybody familiar or have other suggestions?
For the rotational transformation matrix, I have these:
But don’t know how to actually implement them in blueprints, and can’t find anything to help with that.
After it is yawed 45 and rolled 90 it would need to pitch -45 in local space to get back on target or -45 yaw in world space to get back on target. Are you using local rotations for everything?
Yep, the problem is finding a way to tell the system how/when to do that. See above blueprints.
I’m not sure where to check whether I’m using local/non-local rotations. The blueprints above show a “world” coordinate space, but otherwise…?
It would help to see the blueprint that does the rotating. I think the big question though is how do you want the X rotation to behave? Do you want X to rotate as little as possible to help achieve the result, or do you want X to 0 out and level the ship as it goes to the destination, or does X even matter. If you are in space you might want it to rotate as little as possible, on earth you may want it to zero out and level the craft.
If you want X to just zero out, you can zero it out before you do the calculation to determine Z and Y rotations to see what rotations they need to make and then slowly zero X out while they are being made.
If you want X to rotate to help position the craft toward the autopilot destination idk, cause yaw and pitching may be different speed and whether to roll or not would depend on that. What I would do is completely ignore X and just do Y and Z rotations, it’s easier to program. After that study it a bit and see if you can’t find a good way to handle X.
Hello,
So here’s where the code feeds to (for pitch, they’re all basically the same, just for different rotations):
The original post’s blueprints show what’s contained within the “Autopilot” function, and the unshown code to the right is just for visual effects.
When you say X, you’re referring to rotation around the X axis? I don’t think zeroing it out is really what I’m looking for. All three rotation calculations (see blueprints) are done independently of each other. The problem stems from the relative positioning being determined from the path of travel (spline) rather than from the craft itself.
To clarify, I’m not trying to tell it how/when to roll. It already knows how to do that. But if roll autopilot is turned off, so it STAYS rolled, say, 90 degrees, then because position is relative to spline, if the craft is positioned off-centre on the horizontal plane of the spline, it will feed the autopilot yaw instructions, even though with the craft’s rotation of 90 degrees it would actually need to pitch to get back to position.
The main thing is I’m trying to make the orientation information be relative to the craft, rather than relative to the spline, and can’t find a way to do that.
I feel like the matrix must already exist in blueprints, and it’s just a question of finding out how to implement it.