I write a class CWAxisYDetector derived from AbstractDetector, the code is:
public class CWAxisYDetector extends AbstractDetector {
private LocalOrbitalFrame locOrbFrm;
private AbsoluteDate initDate;
protected CWAxisYDetector(Orbit targOrb, LocalOrbitalFrame lof,
AbsoluteDate iDate) {
super(targOrb.getKeplerianPeriod() / 3, 1.0e-13 *
targOrb.getKeplerianPeriod());
this.locOrbFrm = lof;
this.initDate = iDate;
}
public int eventOccurred(SpacecraftState s, boolean increasing)
throws OrekitException {
System.out.println(s.getDate().durationFrom(initDate));
return CONTINUE;
}
public double g(SpacecraftState s) throws OrekitException {
return s.getPVCoordinates(locOrbFrm).getPosition().getX();
}
}
but this class can't correct detecting event, and in some integrate
step getinig error information:
Exception in thread "main"
org.apache.commons.math.MathRuntimeException$4: function values at
endpoints do not have different signs. Endpoints: [0.539, 0.539],
Values: [0, 0]
at
org.apache.commons.math.MathRuntimeException.createIllegalArgumentException(MathRuntimeException.java:305)
at
org.apache.commons.math.analysis.solvers.BrentSolver.solve(BrentSolver.java:219)
at
org.apache.commons.math.ode.events.EventState.evaluateStep(EventState.java:229)
at
org.apache.commons.math.ode.events.CombinedEventsManager.evaluateStep(CombinedEventsManager.java:152)
at
org.apache.commons.math.ode.nonstiff.RungeKuttaIntegrator.integrate(RungeKuttaIntegrator.java:172)
at
org.orekit.propagation.numerical.NumericalPropagator.propagate(NumericalPropagator.java:419)
at fr.cs.examples.propagation.SlaveMode.main(SlaveMode.java:136)
why?