AngularVelocity.java

  1. /* Copyright 2022-2025 Luc Maisonobe
  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. package org.orekit.files.ccsds.ndm.adm.apm;

  18. import org.orekit.files.ccsds.definitions.FrameFacade;
  19. import org.orekit.files.ccsds.ndm.adm.AttitudeEndpoints;
  20. import org.orekit.files.ccsds.section.CommentsContainer;

  21. /**
  22.  * Container for Attitude Parameter Message data lines.
  23.  * <p>
  24.  * Beware that the Orekit getters and setters all rely on SI units. The parsers
  25.  * and writers take care of converting these SI units into CCSDS mandatory units.
  26.  * The {@link org.orekit.utils.units.Unit Unit} class provides useful
  27.  * {@link org.orekit.utils.units.Unit#fromSI(double) fromSi} and
  28.  * {@link org.orekit.utils.units.Unit#toSI(double) toSI} methods in case the callers
  29.  * already use CCSDS units instead of the API SI units. The general-purpose
  30.  * {@link org.orekit.utils.units.Unit Unit} class (without an 's') and the
  31.  * CCSDS-specific {@link org.orekit.files.ccsds.definitions.Units Units} class
  32.  * (with an 's') also provide some predefined units. These predefined units and the
  33.  * {@link org.orekit.utils.units.Unit#fromSI(double) fromSi} and
  34.  * {@link org.orekit.utils.units.Unit#toSI(double) toSI} conversion methods are indeed
  35.  * what the parsers and writers use for the conversions.
  36.  * </p>
  37.  * @author Luc Maisonobe
  38.  * @since 12.0
  39.  */
  40. public class AngularVelocity extends CommentsContainer {

  41.     /** Endpoints (i.e. frames A, B and their relationship). */
  42.     private final AttitudeEndpoints endpoints;

  43.     /** The frame in which angular velocities are specified. */
  44.     private FrameFacade frame;

  45.     /** Angular velocity around X axis (rad/s). */
  46.     private double angVelX;

  47.     /** Angular velocity around Y axis (rad/s). */
  48.     private double angVelY;

  49.     /** Angular velocity around Z axis (rad/s). */
  50.     private double angVelZ;

  51.     /** Simple constructor.
  52.      */
  53.     public AngularVelocity() {
  54.         endpoints = new AttitudeEndpoints();
  55.         frame     = null;
  56.         angVelX   = Double.NaN;
  57.         angVelY   = Double.NaN;
  58.         angVelZ   = Double.NaN;
  59.     }

  60.     /** {@inheritDoc} */
  61.     @Override
  62.     public void validate(final double version) {
  63.         super.validate(version);
  64.         endpoints.checkMandatoryEntriesExceptExternalFrame(version,
  65.                                                            AngularVelocityKey.REF_FRAME_A,
  66.                                                            AngularVelocityKey.REF_FRAME_B,
  67.                                                            null);
  68.         endpoints.checkExternalFrame(AngularVelocityKey.REF_FRAME_A, AngularVelocityKey.REF_FRAME_B);
  69.         checkNotNull(frame, AngularVelocityKey.ANGVEL_FRAME.name());
  70.         checkNotNaN(angVelX, AngularVelocityKey.ANGVEL_X.name());
  71.         checkNotNaN(angVelY, AngularVelocityKey.ANGVEL_Y.name());
  72.         checkNotNaN(angVelZ, AngularVelocityKey.ANGVEL_Z.name());
  73.     }

  74.     /** Get the endpoints (i.e. frames A, B and their relationship).
  75.      * @return endpoints
  76.      */
  77.     public AttitudeEndpoints getEndpoints() {
  78.         return endpoints;
  79.     }

  80.     /** Set frame in which angular velocities are specified.
  81.      * @param frame frame in which angular velocities are specified
  82.      */
  83.     public void setFrame(final FrameFacade frame) {
  84.         this.frame = frame;
  85.     }

  86.     /** Get frame in which angular velocities are specified.
  87.      * @return frame in which angular velocities are specified
  88.      */
  89.     public FrameFacade getFrame() {
  90.         return frame;
  91.     }

  92.     /** Get the angular velocity around X axis (rad/s).
  93.      * @return angular velocity around X axis (rad/s)
  94.      */
  95.     public double getAngVelX() {
  96.         return angVelX;
  97.     }

  98.     /** Set the angular velocity around X axis (rad/s).
  99.      * @param angVelX angular velocity around X axis (rad/s)
  100.      */
  101.     public void setAngVelX(final double angVelX) {
  102.         refuseFurtherComments();
  103.         this.angVelX = angVelX;
  104.     }

  105.     /** Get the angular velocity around Y axis (rad/s).
  106.      * @return angular velocity around Y axis (rad/s)
  107.      */
  108.     public double getAngVelY() {
  109.         return angVelY;
  110.     }

  111.     /** Set the angular velocity around Z axis (rad/s).
  112.      * @param angVelZ angular velocity around Z axis (rad/s)
  113.      */
  114.     public void setAngVelZ(final double angVelZ) {
  115.         refuseFurtherComments();
  116.         this.angVelZ = angVelZ;
  117.     }

  118.     /** Get the angular velocity around Z axis (rad/s).
  119.      * @return angular velocity around Z axis (rad/s)
  120.      */
  121.     public double getAngVelZ() {
  122.         return angVelZ;
  123.     }

  124.     /** Set the angular velocity around Y axis (rad/s).
  125.      * @param angVelY angular velocity around Y axis (rad/s)
  126.      */
  127.     public void setAngVelY(final double angVelY) {
  128.         refuseFurtherComments();
  129.         this.angVelY = angVelY;
  130.     }

  131. }