Hi @petrus.hyvonen and @marc ,
I convert the python code to java, the full error message is as followings:
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "org.orekit.time.AbsoluteDate.durationFrom(org.orekit.time.AbsoluteDate)" because "start" is null
at org.orekit.estimation.measurements.generation.AngularRaDecBuilder.build(AngularRaDecBuilder.java:82)
at test.T1.t2(T1.java:71)
The line 82 of “AngularRaDecBuilder.java”:
// set a reference date for parameters missing one
for (final ParameterDriver driver : dummy.getParametersDrivers()) {
if (driver.getReferenceDate() == null) {
final AbsoluteDate start = getStart();
final AbsoluteDate end = getEnd();
L82--> driver.setReferenceDate(start.durationFrom(end) <= 0 ? start : end);
}
}
So the exception is due to that “the start data is null”, actually the end date is also null.
See deeply in class AbstractMeasurementBuilder,which is the parent class of AngularRaDecBuilder,
there is a method init to initialize builder at the start of a measurements generation, “…typically setting up parameters reference dates”.
public void init(final AbsoluteDate start, final AbsoluteDate end) {
spanStart = start;
spanEnd = end;
}
So you should call ra_dec_builder.init(startDate, endDate) once before building an measurement.
Furthermore, it is better to use these builders with org.orekit.estimation.measurements.generation.Generator.
Regards,
Lirw