1   /* Copyright 2002-2022 CS GROUP
2    * Licensed to CS GROUP (CS) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * CS licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *   http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  
18  package org.orekit.estimation.common;
19  
20  import org.hipparchus.geometry.euclidean.threed.Vector3D;
21  import org.orekit.attitudes.AttitudeProvider;
22  import org.orekit.attitudes.BodyCenterPointing;
23  import org.orekit.attitudes.InertialProvider;
24  import org.orekit.attitudes.LofOffset;
25  import org.orekit.attitudes.NadirPointing;
26  import org.orekit.attitudes.YawCompensation;
27  import org.orekit.attitudes.YawSteering;
28  import org.orekit.bodies.CelestialBodyFactory;
29  import org.orekit.bodies.OneAxisEllipsoid;
30  import org.orekit.frames.Frame;
31  import org.orekit.frames.FramesFactory;
32  import org.orekit.frames.LOFType;
33  
34  /** Attitude modes.
35   * @author Luc Maisonobe
36   */
37  enum AttitudeMode {
38  
39      /** Default law. */
40      DEFAULT_LAW() {
41          /** {@inheritDoc} */
42          @Override
43          public AttitudeProvider getProvider(Frame inertialFrame,
44                                              OneAxisEllipsoid body) {
45              return InertialProvider.of(FramesFactory.getEME2000());
46          }
47      },
48  
49      /** Nadir pointing with yaw compensation. */
50      NADIR_POINTING_WITH_YAW_COMPENSATION() {
51          /** {@inheritDoc} */
52          @Override
53          public AttitudeProvider getProvider(final Frame inertialFrame, final OneAxisEllipsoid body) {
54              return new YawCompensation(inertialFrame, new NadirPointing(inertialFrame, body));
55          }
56      },
57  
58      /** Body center pointing with yaw compensation. */
59      CENTER_POINTING_WITH_YAW_STEERING {
60          /** {@inheritDoc} */
61          @Override
62          public AttitudeProvider getProvider(final Frame inertialFrame, final OneAxisEllipsoid body) {
63              return new YawSteering(inertialFrame,
64                                     new BodyCenterPointing(inertialFrame, body),
65                                     CelestialBodyFactory.getSun(),
66                                     Vector3D.PLUS_I);
67          }
68      },
69  
70      /** Aligned with Local Vertical, Local Horizontal frame. */
71      LOF_ALIGNED_LVLH {
72          /** {@inheritDoc} */
73          @Override
74          public AttitudeProvider getProvider(final Frame inertialFrame, final OneAxisEllipsoid body) {
75              return new LofOffset(inertialFrame, LOFType.LVLH);
76          }
77      },
78  
79      /** Aligned with Local Vertical, Local Horizontal frame, CCSDS definition.
80       * @since 11.0
81       */
82      LOF_ALIGNED_LVLH_CCSDS {
83          /** {@inheritDoc} */
84          @Override
85          public AttitudeProvider getProvider(final Frame inertialFrame, final OneAxisEllipsoid body) {
86              return new LofOffset(inertialFrame, LOFType.LVLH_CCSDS);
87          }
88      },
89  
90      /** Aligned with QSW frame. */
91      LOF_ALIGNED_QSW {
92          /** {@inheritDoc} */
93          @Override
94          public AttitudeProvider getProvider(final Frame inertialFrame, final OneAxisEllipsoid body) {
95              return new LofOffset(inertialFrame, LOFType.QSW);
96          }
97      },
98  
99      /** Aligned with TNW frame. */
100     LOF_ALIGNED_TNW {
101         /** {@inheritDoc} */
102         @Override
103         public AttitudeProvider getProvider(final Frame inertialFrame, final OneAxisEllipsoid body) {
104             return new LofOffset(inertialFrame, LOFType.TNW);
105         }
106     },
107 
108     /** aligned with Velocity - Normal - Co-normal frame. */
109     LOF_ALIGNED_VNC {
110         /** {@inheritDoc} */
111         @Override
112         public AttitudeProvider getProvider(final Frame inertialFrame, final OneAxisEllipsoid body) {
113             return new LofOffset(inertialFrame, LOFType.VNC);
114         }
115     },
116 
117     /** aligned with Equinoctial Coordinate System.
118      * @since 11.0
119      */
120     LOF_ALIGNED_EQW {
121         /** {@inheritDoc} */
122         @Override
123         public AttitudeProvider getProvider(final Frame inertialFrame, final OneAxisEllipsoid body) {
124             return new LofOffset(inertialFrame, LOFType.EQW);
125         }
126     },
127 
128     /** aligned with Transverse Velocity Normal coordinate system.
129      * @since 11.0
130      */
131     LOF_ALIGNED_NTW {
132         /** {@inheritDoc} */
133         @Override
134         public AttitudeProvider getProvider(final Frame inertialFrame, final OneAxisEllipsoid body) {
135             return new LofOffset(inertialFrame, LOFType.NTW);
136         }
137     };
138 
139     /** Get attitude provider.
140      * @param inertialFrame inertial frame
141      * @param body central body
142      * @return attitude provider
143      */
144     public abstract AttitudeProvider getProvider(Frame inertialFrame, OneAxisEllipsoid body);
145 
146 }