Commit f0165a12 authored by Bryan Cazabonne's avatar Bryan Cazabonne
Browse files

Allowed setting the AttitudeProvider to the IntegratedEphemeris.

parent 3179cf70
Pipeline #1379 passed with stages
in 20 minutes and 39 seconds
......@@ -21,6 +21,10 @@
</properties>
<body>
<release version="11.0" date="TBD" description="TBD">
<action dev="bryan" type="update" issue="766" due-to="Gowtham Sivaraman">
Allowed setting of AttitudeProvider to the BoundedPropagator
generated via propagation.
</action>
<action dev="bryan" type="fix" issue="835">
Fixed format symbols for year, month, day in DateComponents#toString().
</action>
......
......@@ -21,6 +21,7 @@ import java.util.Map;
import org.hipparchus.ode.DenseOutputModel;
import org.hipparchus.ode.ODEStateAndDerivative;
import org.orekit.attitudes.AttitudeProvider;
import org.orekit.errors.OrekitException;
import org.orekit.errors.OrekitMessages;
import org.orekit.frames.Frame;
......@@ -216,6 +217,17 @@ public class IntegratedEphemeris
throw new OrekitException(OrekitMessages.NON_RESETABLE_STATE);
}
/** {@inheritDoc} */
@Override
public void setAttitudeProvider(final AttitudeProvider attitudeProvider) {
super.setAttitudeProvider(attitudeProvider);
if (mapper != null) {
// At the construction, the mapper is not set yet
// However, if the attitude provider is changed afterwards, it must be changed in the mapper too
mapper.setAttitudeProvider(attitudeProvider);
}
}
/** {@inheritDoc} */
public SpacecraftState getInitialState() {
return updateAdditionalStates(basicPropagate(getMinDate()));
......
......@@ -39,15 +39,15 @@ public abstract class StateMapper {
/** Position angle type. */
private final PositionAngle angleType;
/** Attitude provider. */
private final AttitudeProvider attitudeProvider;
/** Central attraction coefficient. */
private final double mu;
/** Inertial frame. */
private final Frame frame;
/** Attitude provider. */
private AttitudeProvider attitudeProvider;
/** Simple constructor.
* <p>
* The position parameter type is meaningful only if {@link
......@@ -89,11 +89,6 @@ public abstract class StateMapper {
return orbitType;
}
/** Set position angle type.
*/
public void setPositionAngleType() {
}
/** Get propagation parameter type.
* @return angle type to use for propagation
*/
......@@ -122,6 +117,13 @@ public abstract class StateMapper {
return attitudeProvider;
}
/** Set the attitude provider.
* @param attitudeProvider the provider to set
*/
public void setAttitudeProvider(final AttitudeProvider attitudeProvider) {
this.attitudeProvider = attitudeProvider;
}
/** Map the raw double time offset to a date.
* @param t date offset
* @return date
......
......@@ -26,6 +26,9 @@ import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.orekit.Utils;
import org.orekit.attitudes.CelestialBodyPointed;
import org.orekit.attitudes.InertialProvider;
import org.orekit.bodies.CelestialBodyFactory;
import org.orekit.forces.gravity.potential.GravityFieldFactory;
import org.orekit.forces.gravity.potential.ICGEMFormatReader;
import org.orekit.frames.FramesFactory;
......@@ -44,6 +47,7 @@ import org.orekit.propagation.sampling.OrekitStepInterpolator;
import org.orekit.time.AbsoluteDate;
import org.orekit.utils.Constants;
import org.orekit.utils.PVCoordinates;
import org.orekit.utils.PVCoordinatesProvider;
public class IntegratedEphemerisTest {
......@@ -139,6 +143,28 @@ public class IntegratedEphemerisTest {
Assert.assertSame(ephemeris.getFrame(), numericalPropagator.getFrame());
}
@Test
public void testIssue766() {
// setup
AbsoluteDate finalDate = initialOrbit.getDate().shiftedBy(Constants.JULIAN_DAY);
final EphemerisGenerator generator = numericalPropagator.getEphemerisGenerator();
numericalPropagator.setInitialState(new SpacecraftState(initialOrbit));
numericalPropagator.propagate(finalDate);
Assert.assertTrue(numericalPropagator.getCalls() < 3200);
BoundedPropagator ephemeris = generator.getGeneratedEphemeris();
// verify
Assert.assertTrue(ephemeris.getAttitudeProvider() instanceof InertialProvider);
// action
PVCoordinatesProvider sun = CelestialBodyFactory.getSun();
ephemeris.setAttitudeProvider(new CelestialBodyPointed(FramesFactory.getEME2000(), sun, Vector3D.PLUS_K,
Vector3D.PLUS_I, Vector3D.PLUS_K));
Assert.assertTrue(ephemeris.getAttitudeProvider() instanceof CelestialBodyPointed);
}
@Before
public void setUp() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment