Good morning,
I have a doubt on some results I’m obtaining while renning the following code:
// Orbit
double a = 6860176.23765572;
double e = 0.0010160613326433334;
double i = 1.7044014447593043;
double om = 1.439233350035424;
double OM = 1.3884502116745805;
double th = 1.1625681691480643;
AbsoluteDate startingEpoch = new AbsoluteDate(2022, 01, 01, 12, 00, 0.0, TimeScalesFactory.getTAI());
AbsoluteDate finalEpoch = new AbsoluteDate(2022, 01, 03, 12, 00, 0.0, TimeScalesFactory.getTAI());
Orbit keplerianOrbit = new KeplerianOrbit(a, e, i, om, OM, th, PositionAngle.TRUE, FramesFactory.getEME2000(), startingEpoch, Constants.IERS2010_EARTH_MU);
Attitude initAttitude = new Attitude(startingEpoch,
FramesFactory.getEME2000(),
new Rotation(RotationOrder.XYZ, RotationConvention.FRAME_TRANSFORM, 0.0, 0.0, 0.0),
new Vector3D(10 * Math.PI / 180, 20 * Math.PI / 180, 30 * Math.PI / 180),
new Vector3D(0, 0, 0));
System.out.println("first rot angle = " + initAttitude.getRotation().getAngles(RotationOrder.XYZ, RotationConvention.FRAME_TRANSFORM)[0]);
System.out.println("second rot angle = " + initAttitude.getRotation().getAngles(RotationOrder.XYZ, RotationConvention.FRAME_TRANSFORM)[1]);
System.out.println("third rot angle = " + initAttitude.getRotation().getAngles(RotationOrder.XYZ, RotationConvention.FRAME_TRANSFORM)[2]);
System.out.println("init spin in sat = " + initAttitude.getSpin());
Transform initTransform = new Transform(startingEpoch, initAttitude.getRotation());
System.out.println("init spin in EME2000 = " + initTransform.transformVector(initAttitude.getSpin()));
System.out.println("----------");
// Propagator
NumericalPropagator prop = new NumericalPropagator(new ClassicalRungeKuttaIntegrator(0.5));
prop.setInitialState(new SpacecraftState(keplerianOrbit));
prop.setAttitudeProvider(new FixedRate(initAttitude));
// Propagate
SpacecraftState finSpacecraftState = prop.propagate(finalEpoch);
Attitude finAttitude = finSpacecraftState.getAttitude();
System.out.println("first rot angle = " + finAttitude.getRotation().getAngles(RotationOrder.XYZ, RotationConvention.FRAME_TRANSFORM)[0]);
System.out.println("second rot angle = " + finAttitude.getRotation().getAngles(RotationOrder.XYZ, RotationConvention.FRAME_TRANSFORM)[1]);
System.out.println("third rot angle = " + finAttitude.getRotation().getAngles(RotationOrder.XYZ, RotationConvention.FRAME_TRANSFORM)[2]);
System.out.println("fin spin in sat = " + finAttitude.getSpin());
Transform finTransform = new Transform(finalEpoch, finAttitude.getRotation());
System.out.println("fin spin in EME2000 = " + finTransform.transformVector(finAttitude.getSpin()));
What I am doing here is to set an attitude providing a spin rate. Then I use it to define a fixed rate attitude provider and finally I propagate.
The results in this case are the following:
first rot angle = -0.0
second rot angle = 0.0
third rot angle = -0.0
init spin in sat = {0.1745329252; 0.3490658504; 0.5235987756}
init spin in EME2000 = {0.1745329252; 0.3490658504; 0.5235987756}
----------
first rot angle = -0.09152175482841884
second rot angle = -0.13977086485070148
third rot angle = -0.2313333923783455
fin spin in sat = {0.1745329252; 0.3490658504; 0.5235987756}
fin spin in EME2000 = {0.1745329252; 0.3490658504; 0.5235987756}
Then I tried to change the definition of the initial attitude providing an initial rotation between the attitude and the reference frame, as reported:
Attitude initAttitude = new Attitude(startingEpoch,
FramesFactory.getEME2000(),
new Rotation(RotationOrder.XYZ, RotationConvention.FRAME_TRANSFORM, 0.1, 0.2, 0.3),
new Vector3D(10 * Math.PI / 180, 20 * Math.PI / 180, 30 * Math.PI / 180),
new Vector3D(0, 0, 0));
Running again the code, I get:
first rot angle = 0.09999999999999998
second rot angle = 0.20000000000000004
third rot angle = 0.3
init spin in sat = {0.1745329252; 0.3490658504; 0.5235987756}
init spin in EME2000 = {0.189235889; 0.3597387985; 0.5111185409}
----------
first rot angle = 0.054659698819354584
second rot angle = 0.03926550710026943
third rot angle = 0.08050722697220719
fin spin in sat = {0.1745329252; 0.3490658504; 0.5235987756}
fin spin in EME2000 = {0.1844533141; 0.3634935849; 0.5102095416}
I cannot understand why the “fin spin in EME2000” is now different from the “init spin in EME2000”. Why does the definition of an initial attitude different from the reference one imply these two results?
I feel like I am missing something very stupid in all this.
Thank you!
Thomas
UPDATE:
I think I just found the problem… The last line of the code should be:
System.out.println("fin spin in EME2000 = " + finTransform.getInverse().transformVector(finAttitude.getSpin()));
Right?