1   /* Copyright 2002-2020 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.LofOffset;
24  import org.orekit.attitudes.NadirPointing;
25  import org.orekit.attitudes.YawCompensation;
26  import org.orekit.attitudes.YawSteering;
27  import org.orekit.bodies.CelestialBodyFactory;
28  import org.orekit.bodies.OneAxisEllipsoid;
29  import org.orekit.frames.Frame;
30  import org.orekit.frames.LOFType;
31  
32  /** Attitude modes.
33   * @author Luc Maisonobe
34   */
35  enum AttitudeMode {
36  
37      /** Nadir pointing with yaw compensation. */
38      NADIR_POINTING_WITH_YAW_COMPENSATION() {
39          /** {@inheritDoc} */
40          @Override
41          public AttitudeProvider getProvider(final Frame inertialFrame, final OneAxisEllipsoid body) {
42              return new YawCompensation(inertialFrame, new NadirPointing(inertialFrame, body));
43          }
44      },
45  
46      /** Body center pointing with yaw compensation. */
47      CENTER_POINTING_WITH_YAW_STEERING {
48          /** {@inheritDoc} */
49          @Override
50          public AttitudeProvider getProvider(final Frame inertialFrame, final OneAxisEllipsoid body) {
51              return new YawSteering(inertialFrame,
52                                     new BodyCenterPointing(inertialFrame, body),
53                                     CelestialBodyFactory.getSun(),
54                                     Vector3D.PLUS_I);
55          }
56      },
57  
58      /** Aligned with Local Vertical, Local Horizontal frame. */
59      LOF_ALIGNED_LVLH {
60          /** {@inheritDoc} */
61          @Override
62          public AttitudeProvider getProvider(final Frame inertialFrame, final OneAxisEllipsoid body) {
63              return new LofOffset(inertialFrame, LOFType.LVLH);
64          }
65      },
66  
67      /** Aligned with QSW frame. */
68      LOF_ALIGNED_QSW {
69          /** {@inheritDoc} */
70          @Override
71          public AttitudeProvider getProvider(final Frame inertialFrame, final OneAxisEllipsoid body) {
72              return new LofOffset(inertialFrame, LOFType.QSW);
73          }
74      },
75  
76      /** Aligned with TNW frame. */
77      LOF_ALIGNED_TNW {
78          /** {@inheritDoc} */
79          @Override
80          public AttitudeProvider getProvider(final Frame inertialFrame, final OneAxisEllipsoid body) {
81              return new LofOffset(inertialFrame, LOFType.TNW);
82          }
83      },
84  
85      /** aligned with Velocity - Normal - Co-normal frame. */
86      LOF_ALIGNED_VNC {
87          /** {@inheritDoc} */
88          @Override
89          public AttitudeProvider getProvider(final Frame inertialFrame, final OneAxisEllipsoid body) {
90              return new LofOffset(inertialFrame, LOFType.VNC);
91          }
92      },
93  
94      /** Aligned with Vehicle Velocity, Local Horizontal frame. */
95      LOF_ALIGNED_VVLH {
96          /** {@inheritDoc} */
97          @Override
98          public AttitudeProvider getProvider(final Frame inertialFrame, final OneAxisEllipsoid body) {
99              return new LofOffset(inertialFrame, LOFType.VVLH);
100         }
101     };
102 
103     /** Get attitude provider.
104      * @param inertialFrame inertial frame
105      * @param body central body
106      * @return attitude provider
107      */
108     public abstract AttitudeProvider getProvider(Frame inertialFrame, OneAxisEllipsoid body);
109 
110 }