ericstoneking / 42

Simulation for spacecraft attitude control system analysis and design
251 stars 82 forks source link

"Initial Attitude" for B Axes with respect to L Axes #60

Closed PeteBlanchard closed 3 years ago

PeteBlanchard commented 3 years ago

Mr. Stoneking,

What controls the initial orientation of the spacecraft B Axes with respect to the L Axes? I see the "Initial Attitude" (in SC_*.txt) angles set to zero's, the rotation quaternion is identity...shouldn't the initial orientation of the spacecraft body axes line up with the local vertical, local horizontal axes? If not (and it appears not), what controls that? When I turn the Axes on in the UI, they do not line up.

Looking at a small sat, so only one body, no joints. Looking at the .obj file, the sat lines up on the axes with center at origin.

Thanks in advance.

ericstoneking commented 3 years ago

Hi Pete,

Line 13 is the key. Change that "NAN" to "LAL".

To explain what's going on, line 13 is a three-letter key to how the following three lines should be interpreted. The first character controls which frame the angular velocity in line 14 is with respect to. (If it's L, then orbit rate gets added in appropriately.) The second character (either Q or A) controls whether the [Q]uaternion on line 15 or the Euler [A]ngles on line 16 are used for the initial attitude. The third character controls which frame the initial attitude is defined with respect to.

Regards, -Eric (he/him)

PeteBlanchard commented 3 years ago

ah! Makes sense, thank you. As soon as I wrote this I noticed it was aligned with the N Axes but missed the significance of line 13.

Thanks again!

PeteBlanchard commented 3 years ago

Okay, dumb follow up...after I change to LAL, the Y axes (2) line up fine, but the X and Z of the B appear ~180 degrees off (or so) from the L Axes (look to be rotated around the Y). I don't want to give it an angular momentum and have it spinning...so, I need to compute the quaternion to give it my desired orientation (and change to LQL), correct?

ericstoneking commented 3 years ago

Hm. Can you show me that section of your SC file, and a screenshot showing your L and B axes? (Tip: Pressing 'F1' will save a Cam window screenshot as Screenshots/CamSnap.ppm.)

PeteBlanchard commented 3 years ago

Here ya go... LAL_SC_Axes SC_file

ericstoneking commented 3 years ago

Okay, your initial attitude section is good. Since you're using PROTOTYPE_FSW, now I'm curious about your Inp_Cmd.txt. Another tip: In Inp_Graphics.txt, line 8, you can make 42 pause at startup, so you can examine the initial condition. My question is, was the initial attitude wrong, or did the attitude start properly and get steered off by PROTOTYPE_FSW?

PeteBlanchard commented 3 years ago

Interesting...I switched back to PASSIVE_FSW as a test, and the attitude is still off...

ericstoneking commented 3 years ago

Sorry, I'm stumped. It behaves as expected on my setup. Looks like you've voided the warranty... :-) Good luck with your bug hunt.

PeteBlanchard commented 3 years ago

Ha! No worries, I appreciate the quick responses. You've been very helpful once again! Thanks for the information. :-)