Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/release-12.2' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
petrushy committed Oct 19, 2024
2 parents 3d82836 + 477d4c5 commit 1d82b31
Show file tree
Hide file tree
Showing 409 changed files with 20,847 additions and 4,434 deletions.
18 changes: 12 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<groupId>org.orekit</groupId>
<artifactId>orekit</artifactId>
<packaging>jar</packaging>
<version>12.1.2</version>
<version>12.2</version>
<name>OREKIT</name>
<url>http://www.orekit.org/</url>
<url>https://www.orekit.org/</url>

<inceptionYear>2002</inceptionYear>
<description>
Expand All @@ -34,7 +34,7 @@
<orekit.maven-jar-plugin.version>3.4.1</orekit.maven-jar-plugin.version>
<orekit.maven-jxr-plugin.version>3.4.0</orekit.maven-jxr-plugin.version>
<orekit.plantuml-maven-plugin.version>1.2</orekit.plantuml-maven-plugin.version>
<orekit.plantuml.version>1.2024.5</orekit.plantuml.version>
<orekit.plantuml.version>1.2024.7</orekit.plantuml.version>
<orekit.maven-resources-plugin.version>3.3.1</orekit.maven-resources-plugin.version>
<orekit.maven-site-plugin.version>3.12.1</orekit.maven-site-plugin.version>
<orekit.maven-project-info-reports-plugin.version>3.6.0</orekit.maven-project-info-reports-plugin.version>
Expand All @@ -55,8 +55,8 @@
<orekit.mathjax.config>&lt;script type=&quot;text/x-mathjax-config&quot;&gt;MathJax.Hub.Config({ TeX: { extensions: [&quot;autoload.js&quot;]}});&lt;/script&gt;</orekit.mathjax.config>
<orekit.mathjax.enable>&lt;script type=&quot;text/javascript&quot; src=&quot;https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS_CHTML&quot;&gt;&lt;/script&gt;</orekit.mathjax.enable>
<orekit.hipparchus.version>3.1</orekit.hipparchus.version>
<orekit.junit.version>5.10.0</orekit.junit.version>
<orekit.hamcrest.version>2.2</orekit.hamcrest.version>
<orekit.junit.version>5.11.2</orekit.junit.version>
<orekit.hamcrest.version>3.0</orekit.hamcrest.version>
<orekit.compiler.source>1.8</orekit.compiler.source>
<orekit.compiler.target>1.8</orekit.compiler.target>
<orekit.implementation.build>${git.revision}; ${maven.build.timestamp}</orekit.implementation.build>
Expand Down Expand Up @@ -222,6 +222,9 @@
<contributor>
<name>Louis Aucouturier</name>
</contributor>
<contributor>
<name>Rafael Ayala</name>
</contributor>
<contributor>
<name>Lucian B&#259;rbulescu</name>
</contributor>
Expand Down Expand Up @@ -273,6 +276,9 @@
<contributor>
<name>Alberto Foss&#224;</name>
</contributor>
<contributor>
<name>Laura Garcia</name>
</contributor>
<contributor>
<name>Dorian Gegout</name>
</contributor>
Expand Down Expand Up @@ -476,7 +482,7 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.10.0</version>
<version>${orekit.junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
4 changes: 4 additions & 0 deletions spotbugs-exclude-filter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@
<Class name="~.*\.Units$"/>
<Bug pattern="CNT_ROUGH_CONSTANT_VALUE" />
</Match>
<Match>
<Class name="~.*\.IonosphereKlobucharMessage$"/>
<Bug pattern="CNT_ROUGH_CONSTANT_VALUE" />
</Match>

<!-- The following is a false positive from SpotBugs -->
<Match>
Expand Down
687 changes: 444 additions & 243 deletions src/changes/changes.xml

Large diffs are not rendered by default.

22 changes: 21 additions & 1 deletion src/design/attitude-class-diagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,23 @@
#PVCoordinates getTargetPV
}

Frame <-up- "1" Attitude
interface TargetProvider {
+getTargetDirection()
}

enum PredefinedTarget {
+SUN,
+EARTH,
+NADIR,
+NORTH,
+EAST,
+VELOCITY,
+MOMENTUM
}

class GroundPointTarget

Frame <-up- "1" Attitude
Attitude <-up- AttitudeProvider : create
TimeStamped <|.. Attitude
TimeShiftable_T_ <|.. Attitude
Expand All @@ -83,6 +99,8 @@
AttitudeProvider <--* "1" LofOffsetPointing
AttitudeProvider <|.. GroundPointing
LofOffsetPointing --|> GroundPointing
PredefinedTarget ..|> TargetProvider
GroundPointTarget ..|> TargetProvider

AttitudeProviderModifier <|-- SpinStabilized
AttitudeProviderModifier <|-- GroundPointingWrapper
Expand All @@ -98,6 +116,8 @@
AttitudeProvider <|-- LofOffset
AttitudeProvider <|-- TabulatedProvider
AttitudeProvider <|-- TorqueFree
AlignedAndConstrained --|> AttitudeProvider
TargetProvider "2" <--* AlignedAndConstrained

}

Expand Down
203 changes: 203 additions & 0 deletions src/main/java/org/orekit/attitudes/AlignedAndConstrained.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
/* Copyright 2002-2024 Luc Maisonobe
* 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.Field;
import org.hipparchus.analysis.differentiation.FieldUnivariateDerivative2;
import org.hipparchus.analysis.differentiation.UnivariateDerivative2;
import org.hipparchus.analysis.differentiation.UnivariateDerivative2Field;
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.Vector3D;
import org.orekit.bodies.OneAxisEllipsoid;
import org.orekit.frames.Frame;
import org.orekit.time.AbsoluteDate;
import org.orekit.time.FieldAbsoluteDate;
import org.orekit.utils.AngularCoordinates;
import org.orekit.utils.ExtendedPositionProvider;
import org.orekit.utils.FieldAngularCoordinates;
import org.orekit.utils.FieldPVCoordinatesProvider;
import org.orekit.utils.PVCoordinatesProvider;
import org.orekit.utils.TimeStampedFieldPVCoordinates;
import org.orekit.utils.TimeStampedPVCoordinates;

import java.util.HashMap;
import java.util.Map;

/**
* Attitude provider with one satellite vector aligned and another one constrained to two targets.
* @author Luc Maisonobe
* @since 12.2
*/
public class AlignedAndConstrained implements AttitudeProvider
{

/** Satellite vector for primary target. */
private final FieldVector3D<UnivariateDerivative2> primarySat;

/** Primary target. */
private final TargetProvider primaryTarget;

/** Satellite vector for secondary target. */
private final FieldVector3D<UnivariateDerivative2> secondarySat;

/** Secondary target. */
private final TargetProvider secondaryTarget;

/** Sun model. */
private final ExtendedPositionProvider sun;

/** Earth model. */
private final OneAxisEllipsoid earth;

/** Cached field-based satellite vectors. */
private final transient Map<Field<? extends CalculusFieldElement<?>>, Cache<? extends CalculusFieldElement<?>>>
cachedSatelliteVectors;

/**
* Simple constructor.
* @param primarySat satellite vector for primary target
* @param primaryTarget primary target
* @param secondarySat satellite vector for secondary target
* @param secondaryTarget secondary target
* @param sun Sun model
* @param earth Earth model
*/
public AlignedAndConstrained(final Vector3D primarySat, final TargetProvider primaryTarget,
final Vector3D secondarySat, final TargetProvider secondaryTarget,
final ExtendedPositionProvider sun,
final OneAxisEllipsoid earth)
{
this.primarySat = new FieldVector3D<>(UnivariateDerivative2Field.getInstance(), primarySat);
this.primaryTarget = primaryTarget;
this.secondarySat = new FieldVector3D<>(UnivariateDerivative2Field.getInstance(), secondarySat);
this.secondaryTarget = secondaryTarget;
this.sun = sun;
this.earth = earth;
this.cachedSatelliteVectors = new HashMap<>();
}

/** {@inheritDoc} */
@Override
public Rotation getAttitudeRotation(final PVCoordinatesProvider pvProv, final AbsoluteDate date, final Frame frame) {
final TimeStampedPVCoordinates satPV = pvProv.getPVCoordinates(date, frame);

// compute targets references at the specified date
final Vector3D primaryDirection = primaryTarget.getTargetDirection(sun, earth, satPV, frame);
final Vector3D secondaryDirection = secondaryTarget.getTargetDirection(sun, earth, satPV, frame);

// compute transform from inertial frame to satellite frame
return new Rotation(primaryDirection, secondaryDirection, primarySat.toVector3D(), secondarySat.toVector3D());
}

/** {@inheritDoc} */
@Override
public Attitude getAttitude(final PVCoordinatesProvider pvProv,
final AbsoluteDate date,
final Frame frame)
{
final TimeStampedPVCoordinates satPV = pvProv.getPVCoordinates(date, frame);

// compute targets references at the specified date
final FieldVector3D<UnivariateDerivative2> primaryDirection = primaryTarget.getDerivative2TargetDirection(sun, earth, satPV, frame);
final FieldVector3D<UnivariateDerivative2> secondaryDirection = secondaryTarget.getDerivative2TargetDirection(sun, earth, satPV, frame);

// compute transform from inertial frame to satellite frame
final FieldRotation<UnivariateDerivative2> inertToSatRotation =
new FieldRotation<>(primaryDirection, secondaryDirection, primarySat, secondarySat);

// build the attitude
return new Attitude(date, frame, new AngularCoordinates(inertToSatRotation));

}

/** {@inheritDoc} */
@Override
public <T extends CalculusFieldElement<T>> FieldRotation<T> getAttitudeRotation(final FieldPVCoordinatesProvider<T> pvProv,
final FieldAbsoluteDate<T> date,
final Frame frame) {
final TimeStampedFieldPVCoordinates<T> satPV = pvProv.getPVCoordinates(date, frame);

// compute targets references at the specified date
final FieldVector3D<T> primaryDirection = primaryTarget.getTargetDirection(sun, earth, satPV, frame);
final FieldVector3D<T> secondaryDirection = secondaryTarget.getTargetDirection(sun, earth, satPV, frame);

// compute transform from inertial frame to satellite frame
final Field<T> field = date.getField();
return new FieldRotation<>(primaryDirection, secondaryDirection,
new FieldVector3D<>(field, primarySat.toVector3D()), new FieldVector3D<>(field, secondarySat.toVector3D()));
}

/** {@inheritDoc} */
@Override
public <T extends CalculusFieldElement<T>> FieldAttitude<T> getAttitude(final FieldPVCoordinatesProvider<T> pvProv,
final FieldAbsoluteDate<T> date,
final Frame frame)
{
// get the satellite vectors for specified field
@SuppressWarnings("unchecked")
final Cache<T> satVectors =
(Cache<T>) cachedSatelliteVectors.computeIfAbsent(date.getField(),
f -> new Cache<>(date.getField(), primarySat, secondarySat));

final TimeStampedFieldPVCoordinates<T> satPV = pvProv.getPVCoordinates(date, frame);

// compute targets references at the specified date
final FieldVector3D<FieldUnivariateDerivative2<T>> primaryDirection = primaryTarget.getDerivative2TargetDirection(sun, earth, satPV, frame);
final FieldVector3D<FieldUnivariateDerivative2<T>> secondaryDirection = secondaryTarget.getDerivative2TargetDirection(sun, earth, satPV, frame);

// compute transform from inertial frame to satellite frame
final FieldRotation<FieldUnivariateDerivative2<T>> inertToSatRotation =
new FieldRotation<>(primaryDirection, secondaryDirection, satVectors.primarySat, satVectors.secondarySat);

// build the attitude
return new FieldAttitude<>(date, frame, new FieldAngularCoordinates<>(inertToSatRotation));

}

/** Container for cached satellite vectors. */
private static class Cache<T extends CalculusFieldElement<T>> {

/** Satellite vector for primary target. */
private final FieldVector3D<FieldUnivariateDerivative2<T>> primarySat;

/** Satellite vector for primary target. */
private final FieldVector3D<FieldUnivariateDerivative2<T>> secondarySat;

/** Simple constructor.
* @param field field to which the elements belong
* @param primarySat satellite vector for primary target
* @param secondarySat satellite vector for primary target
*/
Cache(final Field<T> field,
final FieldVector3D<UnivariateDerivative2> primarySat,
final FieldVector3D<UnivariateDerivative2> secondarySat) {
final FieldUnivariateDerivative2<T> zero =
new FieldUnivariateDerivative2<>(field.getZero(), field.getZero(), field.getZero());
this.primarySat = new FieldVector3D<>(zero.newInstance(primarySat.getX().getValue()),
zero.newInstance(primarySat.getY().getValue()),
zero.newInstance(primarySat.getZ().getValue()));
this.secondarySat = new FieldVector3D<>(zero.newInstance(secondarySat.getX().getValue()),
zero.newInstance(secondarySat.getY().getValue()),
zero.newInstance(secondarySat.getZ().getValue()));
}

}

}
31 changes: 20 additions & 11 deletions src/main/java/org/orekit/attitudes/AttitudesSequence.java
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,17 @@ public <T extends CalculusFieldElement<T>> FieldRotation<T> getAttitudeRotation(
return activated.get(date.toAbsoluteDate()).getAttitudeRotation(pvProv, date, frame);
}

/**
* Gets a deep copy of the switches stored in this instance.
*
* @return deep copy of the switches stored in this instance
*/
public List<Switch> getSwitches() {
return new ArrayList<>(switches);
}

/** Switch specification. */
private class Switch implements EventDetector, EventHandler {
public class Switch implements EventDetector, EventHandler {

/** Event. */
private final EventDetector event;
Expand Down Expand Up @@ -363,23 +372,23 @@ private class Switch implements EventDetector, EventHandler {
/** Propagation direction. */
private boolean forward;

/** Simple constructor.
/**
* Simple constructor.
*
* @param event event
* @param switchOnIncrease if true, switch is triggered on increasing event
* @param switchOnDecrease if true, switch is triggered on decreasing event
* otherwise switch is triggered on decreasing event
* @param switchOnDecrease if true, switch is triggered on decreasing event otherwise switch is triggered on
* decreasing event
* @param past attitude provider applicable for times in the switch event occurrence past
* @param future attitude provider applicable for times in the switch event occurrence future
* @param transitionTime duration of the transition between the past and future attitude laws
* @param transitionFilter order at which the transition law time derivatives
* should match past and future attitude laws
* @param transitionFilter order at which the transition law time derivatives should match past and future attitude
* laws
* @param switchHandler handler to call for notifying when switch occurs (may be null)
*/
Switch(final EventDetector event,
final boolean switchOnIncrease, final boolean switchOnDecrease,
final AttitudeProvider past, final AttitudeProvider future,
final double transitionTime, final AngularDerivativesFilter transitionFilter,
final SwitchHandler switchHandler) {
private Switch(final EventDetector event, final boolean switchOnIncrease, final boolean switchOnDecrease,
final AttitudeProvider past, final AttitudeProvider future, final double transitionTime,
final AngularDerivativesFilter transitionFilter, final SwitchHandler switchHandler) {
this.event = event;
this.switchOnIncrease = switchOnIncrease;
this.switchOnDecrease = switchOnDecrease;
Expand Down
Loading

0 comments on commit 1d82b31

Please sign in to comment.