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 19 import org.orekit.files.ccsds.definitions.FrameFacade; 20 import org.orekit.files.ccsds.ndm.adm.AttitudeEndpoints; 21 import org.orekit.files.ccsds.section.CommentsContainer; 22 23 /** 24 * Container for Attitude Parameter Message data lines. 25 * <p> 26 * Beware that the Orekit getters and setters all rely on SI units. The parsers 27 * and writers take care of converting these SI units into CCSDS mandatory units. 28 * The {@link org.orekit.utils.units.Unit Unit} class provides useful 29 * {@link org.orekit.utils.units.Unit#fromSI(double) fromSi} and 30 * {@link org.orekit.utils.units.Unit#toSI(double) toSI} methods in case the callers 31 * already use CCSDS units instead of the API SI units. The general-purpose 32 * {@link org.orekit.utils.units.Unit Unit} class (without an 's') and the 33 * CCSDS-specific {@link org.orekit.files.ccsds.definitions.Units Units} class 34 * (with an 's') also provide some predefined units. These predefined units and the 35 * {@link org.orekit.utils.units.Unit#fromSI(double) fromSi} and 36 * {@link org.orekit.utils.units.Unit#toSI(double) toSI} conversion methods are indeed 37 * what the parsers and writers use for the conversions. 38 * </p> 39 * @author Luc Maisonobe 40 * @since 12.0 41 */ 42 public class AngularVelocity extends CommentsContainer { 43 44 /** Endpoints (i.e. frames A, B and their relationship). */ 45 private final AttitudeEndpoints endpoints; 46 47 /** The frame in which angular velocities are specified. */ 48 private FrameFacade frame; 49 50 /** Angular velocity around X axis (rad/s). */ 51 private double angVelX; 52 53 /** Angular velocity around Y axis (rad/s). */ 54 private double angVelY; 55 56 /** Angular velocity around Z axis (rad/s). */ 57 private double angVelZ; 58 59 /** Simple constructor. 60 */ 61 public AngularVelocity() { 62 endpoints = new AttitudeEndpoints(); 63 frame = null; 64 angVelX = Double.NaN; 65 angVelY = Double.NaN; 66 angVelZ = Double.NaN; 67 } 68 69 /** {@inheritDoc} */ 70 @Override 71 public void validate(final double version) { 72 super.validate(version); 73 endpoints.checkMandatoryEntriesExceptExternalFrame(version, 74 AngularVelocityKey.REF_FRAME_A, 75 AngularVelocityKey.REF_FRAME_B, 76 null); 77 endpoints.checkExternalFrame(AngularVelocityKey.REF_FRAME_A, AngularVelocityKey.REF_FRAME_B); 78 checkNotNull(frame, AngularVelocityKey.ANGVEL_FRAME.name()); 79 checkNotNaN(angVelX, AngularVelocityKey.ANGVEL_X.name()); 80 checkNotNaN(angVelY, AngularVelocityKey.ANGVEL_Y.name()); 81 checkNotNaN(angVelZ, AngularVelocityKey.ANGVEL_Z.name()); 82 } 83 84 /** Get the endpoints (i.e. frames A, B and their relationship). 85 * @return endpoints 86 */ 87 public AttitudeEndpoints getEndpoints() { 88 return endpoints; 89 } 90 91 /** Set frame in which angular velocities are specified. 92 * @param frame frame in which angular velocities are specified 93 */ 94 public void setFrame(final FrameFacade frame) { 95 this.frame = frame; 96 } 97 98 /** Get frame in which angular velocities are specified. 99 * @return frame in which angular velocities are specified 100 */ 101 public FrameFacade getFrame() { 102 return frame; 103 } 104 105 /** Get the angular velocity around X axis (rad/s). 106 * @return angular velocity around X axis (rad/s) 107 */ 108 public double getAngVelX() { 109 return angVelX; 110 } 111 112 /** Set the angular velocity around X axis (rad/s). 113 * @param angVelX angular velocity around X axis (rad/s) 114 */ 115 public void setAngVelX(final double angVelX) { 116 refuseFurtherComments(); 117 this.angVelX = angVelX; 118 } 119 120 /** Get the angular velocity around Y axis (rad/s). 121 * @return angular velocity around Y axis (rad/s) 122 */ 123 public double getAngVelY() { 124 return angVelY; 125 } 126 127 /** Set the angular velocity around Z axis (rad/s). 128 * @param angVelZ angular velocity around Z axis (rad/s) 129 */ 130 public void setAngVelZ(final double angVelZ) { 131 refuseFurtherComments(); 132 this.angVelZ = angVelZ; 133 } 134 135 /** Get the angular velocity around Z axis (rad/s). 136 * @return angular velocity around Z axis (rad/s) 137 */ 138 public double getAngVelZ() { 139 return angVelZ; 140 } 141 142 /** Set the angular velocity around Y axis (rad/s). 143 * @param angVelY angular velocity around Y axis (rad/s) 144 */ 145 public void setAngVelY(final double angVelY) { 146 refuseFurtherComments(); 147 this.angVelY = angVelY; 148 } 149 150 }