AngularVelocity.java

  1. /* Copyright 2002-2024 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.  * @author Luc Maisonobe
  24.  * @since 12.0
  25.  */
  26. public class AngularVelocity extends CommentsContainer {

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

  29.     /** The frame in which angular velocities are specified. */
  30.     private FrameFacade frame;

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

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

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

  37.     /** Simple constructor.
  38.      */
  39.     public AngularVelocity() {
  40.         endpoints = new AttitudeEndpoints();
  41.         frame     = null;
  42.         angVelX   = Double.NaN;
  43.         angVelY   = Double.NaN;
  44.         angVelZ   = Double.NaN;
  45.     }

  46.     /** {@inheritDoc} */
  47.     @Override
  48.     public void validate(final double version) {
  49.         super.validate(version);
  50.         endpoints.checkMandatoryEntriesExceptExternalFrame(version,
  51.                                                            AngularVelocityKey.REF_FRAME_A,
  52.                                                            AngularVelocityKey.REF_FRAME_B,
  53.                                                            null);
  54.         endpoints.checkExternalFrame(AngularVelocityKey.REF_FRAME_A, AngularVelocityKey.REF_FRAME_B);
  55.         checkNotNull(frame, AngularVelocityKey.ANGVEL_FRAME.name());
  56.         checkNotNaN(angVelX, AngularVelocityKey.ANGVEL_X.name());
  57.         checkNotNaN(angVelY, AngularVelocityKey.ANGVEL_Y.name());
  58.         checkNotNaN(angVelZ, AngularVelocityKey.ANGVEL_Z.name());
  59.     }

  60.     /** Get the endpoints (i.e. frames A, B and their relationship).
  61.      * @return endpoints
  62.      */
  63.     public AttitudeEndpoints getEndpoints() {
  64.         return endpoints;
  65.     }

  66.     /** Set frame in which angular velocities are specified.
  67.      * @param frame frame in which angular velocities are specified
  68.      */
  69.     public void setFrame(final FrameFacade frame) {
  70.         this.frame = frame;
  71.     }

  72.     /** Get frame in which angular velocities are specified.
  73.      * @return frame in which angular velocities are specified
  74.      */
  75.     public FrameFacade getFrame() {
  76.         return frame;
  77.     }

  78.     /** Get the angular velocity around X axis (rad/s).
  79.      * @return angular velocity around X axis (rad/s)
  80.      */
  81.     public double getAngVelX() {
  82.         return angVelX;
  83.     }

  84.     /** Set the angular velocity around X axis (rad/s).
  85.      * @param angVelX angular velocity around X axis (rad/s)
  86.      */
  87.     public void setAngVelX(final double angVelX) {
  88.         refuseFurtherComments();
  89.         this.angVelX = angVelX;
  90.     }

  91.     /** Get the angular velocity around Y axis (rad/s).
  92.      * @return angular velocity around Y axis (rad/s)
  93.      */
  94.     public double getAngVelY() {
  95.         return angVelY;
  96.     }

  97.     /** Set the angular velocity around Z axis (rad/s).
  98.      * @param angVelZ angular velocity around Z axis (rad/s)
  99.      */
  100.     public void setAngVelZ(final double angVelZ) {
  101.         refuseFurtherComments();
  102.         this.angVelZ = angVelZ;
  103.     }

  104.     /** Get the angular velocity around Z axis (rad/s).
  105.      * @return angular velocity around Z axis (rad/s)
  106.      */
  107.     public double getAngVelZ() {
  108.         return angVelZ;
  109.     }

  110.     /** Set the angular velocity around Y axis (rad/s).
  111.      * @param angVelY angular velocity around Y axis (rad/s)
  112.      */
  113.     public void setAngVelY(final double angVelY) {
  114.         refuseFurtherComments();
  115.         this.angVelY = angVelY;
  116.     }

  117. }