1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.orekit.attitudes;
18
19 import org.hipparchus.CalculusFieldElement;
20 import org.hipparchus.geometry.euclidean.threed.FieldRotation;
21 import org.hipparchus.geometry.euclidean.threed.Rotation;
22 import org.orekit.annotation.DefaultDataContext;
23 import org.orekit.data.DataContext;
24 import org.orekit.frames.Frame;
25 import org.orekit.frames.Transform;
26 import org.orekit.frames.FieldTransform;
27 import org.orekit.time.AbsoluteDate;
28 import org.orekit.time.FieldAbsoluteDate;
29 import org.orekit.utils.FieldPVCoordinatesProvider;
30 import org.orekit.utils.PVCoordinatesProvider;
31
32
33
34
35
36
37
38 public class FrameAlignedProvider implements AttitudeProvider {
39
40
41 private final Frame satelliteFrame;
42
43
44
45
46
47
48
49
50 @DefaultDataContext
51 public FrameAlignedProvider(final Rotation rotation) {
52 this(rotation, DataContext.getDefault().getFrames().getEME2000());
53 }
54
55
56
57
58
59
60 public FrameAlignedProvider(final Frame frame) {
61
62
63 this.satelliteFrame = frame;
64 }
65
66
67
68
69
70
71
72
73 public FrameAlignedProvider(final Rotation rotation,
74 final Frame reference) {
75 satelliteFrame =
76 new Frame(reference,
77 new Transform(AbsoluteDate.ARBITRARY_EPOCH, rotation), null, false);
78 }
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93 public static AttitudeProvider of(final Frame satelliteFrame) {
94 return new FrameAlignedProvider(satelliteFrame);
95 }
96
97
98 @Override
99 public Attitude getAttitude(final PVCoordinatesProvider pvProv,
100 final AbsoluteDate date,
101 final Frame frame) {
102 final Transform t = frame.getTransformTo(satelliteFrame, date);
103 return new Attitude(date, frame, t.getRotation(), t.getRotationRate(), t.getRotationAcceleration());
104 }
105
106
107 @Override
108 public <T extends CalculusFieldElement<T>>FieldAttitude<T> getAttitude(final FieldPVCoordinatesProvider<T> pvProv,
109 final FieldAbsoluteDate<T> date,
110 final Frame frame) {
111 final FieldTransform<T> t = frame.getTransformTo(satelliteFrame, date);
112 return new FieldAttitude<>(date, frame, t.getRotation(), t.getRotationRate(), t.getRotationAcceleration());
113 }
114
115
116 @Override
117 public Rotation getAttitudeRotation(final PVCoordinatesProvider pvProv, final AbsoluteDate date, final Frame frame) {
118 return frame.getStaticTransformTo(satelliteFrame, date).getRotation();
119 }
120
121
122 @Override
123 public <T extends CalculusFieldElement<T>> FieldRotation<T> getAttitudeRotation(final FieldPVCoordinatesProvider<T> pvProv,
124 final FieldAbsoluteDate<T> date,
125 final Frame frame) {
126 return frame.getStaticTransformTo(satelliteFrame, date).getRotation();
127 }
128
129 }