All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.orekit.attitudes.SpinStabilized Maven / Gradle / Ivy

Go to download

OREKIT (ORbits Extrapolation KIT) is a low level space dynamics library. It provides basic elements (orbits, dates, attitude, frames ...) and various algorithms to handle them (conversions, analytical and numerical propagation, pointing ...).

There is a newer version: 12.2
Show newest version
/* Copyright 2002-2024 CS GROUP
 * Licensed to CS GROUP (CS) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * CS licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.orekit.attitudes;

import org.hipparchus.CalculusFieldElement;
import org.hipparchus.geometry.euclidean.threed.FieldRotation;
import org.hipparchus.geometry.euclidean.threed.FieldVector3D;
import org.hipparchus.geometry.euclidean.threed.Rotation;
import org.hipparchus.geometry.euclidean.threed.RotationConvention;
import org.hipparchus.geometry.euclidean.threed.Vector3D;
import org.orekit.frames.FieldTransform;
import org.orekit.frames.Frame;
import org.orekit.frames.Transform;
import org.orekit.time.AbsoluteDate;
import org.orekit.time.FieldAbsoluteDate;
import org.orekit.utils.FieldPVCoordinatesProvider;
import org.orekit.utils.PVCoordinatesProvider;


/**
 * This class handles a spin stabilized attitude provider.
 * 

Spin stabilized laws are handled as wrappers for an underlying * non-rotating law. This underlying law is typically an instance * of {@link CelestialBodyPointed} with the pointing axis equal to * the rotation axis, but can in fact be anything.

*

Instances of this class are guaranteed to be immutable.

* @author Luc Maisonobe */ public class SpinStabilized implements AttitudeProviderModifier { /** Underlying non-rotating attitude provider. */ private final AttitudeProvider nonRotatingLaw; /** Start date of the rotation. */ private final AbsoluteDate start; /** Rotation axis in satellite frame. */ private final Vector3D axis; /** Spin rate in radians per seconds. */ private final double rate; /** Spin vector. */ private final Vector3D spin; /** Creates a new instance. * @param nonRotatingLaw underlying non-rotating attitude provider * @param start start date of the rotation * @param axis rotation axis in satellite frame * @param rate spin rate in radians per seconds */ public SpinStabilized(final AttitudeProvider nonRotatingLaw, final AbsoluteDate start, final Vector3D axis, final double rate) { this.nonRotatingLaw = nonRotatingLaw; this.start = start; this.axis = axis; this.rate = rate; this.spin = new Vector3D(rate / axis.getNorm(), axis); } /** {@inheritDoc} */ @Override public AttitudeProvider getUnderlyingAttitudeProvider() { return nonRotatingLaw; } /** {@inheritDoc} */ @Override public Attitude getAttitude(final PVCoordinatesProvider pvProv, final AbsoluteDate date, final Frame frame) { // get attitude from underlying non-rotating law final Attitude base = nonRotatingLaw.getAttitude(pvProv, date, frame); final Transform baseTransform = new Transform(date, base.getOrientation()); // compute spin transform due to spin from reference to current date final Transform spinInfluence = new Transform(date, new Rotation(axis, rate * date.durationFrom(start), RotationConvention.FRAME_TRANSFORM), spin); // combine the two transforms final Transform combined = new Transform(date, baseTransform, spinInfluence); // build the attitude return new Attitude(date, frame, combined.getRotation(), combined.getRotationRate(), combined.getRotationAcceleration()); } /** {@inheritDoc} */ @Override public Rotation getAttitudeRotation(final PVCoordinatesProvider pvProv, final AbsoluteDate date, final Frame frame) { // get rotation from underlying non-rotating law final Rotation baseRotation = nonRotatingLaw.getAttitudeRotation(pvProv, date, frame); // compute spin rotation due to spin from reference to current date final Rotation spinInfluence = new Rotation(axis, rate * date.durationFrom(start), RotationConvention.FRAME_TRANSFORM); // combine the two rotations return baseRotation.compose(spinInfluence, RotationConvention.FRAME_TRANSFORM); } /** {@inheritDoc} */ @Override public > FieldAttitude getAttitude(final FieldPVCoordinatesProvider pvProv, final FieldAbsoluteDate date, final Frame frame) { // get attitude from underlying non-rotating law final FieldAttitude base = nonRotatingLaw.getAttitude(pvProv, date, frame); final FieldTransform baseTransform = new FieldTransform<>(date, base.getOrientation()); // compute spin transform due to spin from reference to current date final FieldTransform spinInfluence = new FieldTransform<>(date, new FieldRotation<>(new FieldVector3D<>(date.getField(), axis), date.durationFrom(start).multiply(rate), RotationConvention.FRAME_TRANSFORM), new FieldVector3D<>(date.getField(), spin)); // combine the two transforms final FieldTransform combined = new FieldTransform<>(date, baseTransform, spinInfluence); // build the attitude return new FieldAttitude<>(date, frame, combined.getRotation(), combined.getRotationRate(), combined.getRotationAcceleration()); } /** {@inheritDoc} */ @Override public > FieldRotation getAttitudeRotation(final FieldPVCoordinatesProvider pvProv, final FieldAbsoluteDate date, final Frame frame) { // get attitude from underlying non-rotating law final FieldRotation baseRotation = nonRotatingLaw.getAttitudeRotation(pvProv, date, frame); // compute spin rotation due to spin from reference to current date final FieldRotation spinInfluence = new FieldRotation<>(new FieldVector3D<>(date.getField(), axis), date.durationFrom(start).multiply(rate), RotationConvention.FRAME_TRANSFORM); // combine the two rotations return baseRotation.compose(spinInfluence, RotationConvention.FRAME_TRANSFORM); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy