Default attitude in (Field)SpacecraftState

Hiya,

I’d like to change the default attitude (if not passed in constructor) in SpacecraftState and its Field equivalent. It is currently retrieved via a LVLH-based LofOffset (hard coded 9 times in the class btw) which becomes basically the botttleneck of the instantiation. I know users can simply switch to another constructor and pass their own dummy attitude to prevent that, but first they might not know the default is slow and second it can be tedious to do so, especially with Field. For replacement, the FrameAlignedProvider w.r.t. propagation frame is a good candidate I think. Actually, the same AttitudeProvider is the default one for propagators (but with EME2000 always).

This doesn’t break APIs (but might have a number of secondary effects) so in theory it could wait for a minor release, but the sooner the better I would say. Thoughts?

Romain.

Hi @Serrof,

Not against it :wink:
It’s true that using an inertial attitude is better performance-wise compared to a LOF-aligned attitude.
And LOF should be used only when necessary (SRP or drag model different than cannonball model, usage of fields of view etc.).

Changing the default attitude mode will definitely have side effects for users who didn’t override it because they wanted to use LVLH_CCSDS mode specifically.
So it should be well documented in the release notes, at least.

Maxime

I think we changed from inertially oriented to LOF because it is more in line with what most people expect. I alos think it is the default mode in STK, as some people complained when using spacecraft centered field of view that their sensors did not look at the Earth at all whereas it did when they used STK.
Inertially oriented attitude is perfect for performance reasons but… is never used realistically in any mission.

I agree with Luc that most of the time, the user wishes a LOF-aligned attitude.
Inertial oriented attitudes are very common for GTO to GEO transfers for instance, but in that case, the attitude has to be optimized, so the user don’t use the default attitude.

At least, if you want to change this kind of default behavior, please do it in a major release.
Even if it does not really break the API, it can have a huge impacts in some codes.

I mean, I’m only talking about the constructors with no Attitude passed here. If I’m not wrong, outputs from propagators always have theirs defined by the internal AttitudeProvider: as I said, for numerical propagators, the default provider is alignment with J2000 and for instance with KeplerianPropagator, it is aligned with the one used by the input orbit.
If using CCSDS LVLH as a default attitude is a design choice, the Javadoc needs an update, as for now it states that it is arbitrary so at the moment users should definitely NOT expect that behavior as an intended feature.
On another note, I don’t think LVLH makes as much sense in the CR3BP.

Anyway, whatever gets decided, we should at least reduce code duplication in (Field)SpacecraftState.

Cheers,
Romain.

OK, my bad, I was thinking about propagator, not SpacecraftState itself.
+1 for the change

I’ve created issue #1192

MR!408 can be perused. Will integrate at the end of the week if no objections