private double[] derivativesErrors( PVCoordinatesProvider provider, AbsoluteDate date, Frame frame, OneAxisEllipsoid model) throws OrekitException { List<TimeStampedPVCoordinates> pvList = new ArrayList<TimeStampedPVCoordinates>(); List<TimeStampedPVCoordinates> groundPVList = new ArrayList<TimeStampedPVCoordinates>(); for (double dt = -0.25; dt <= 0.25; dt += 0.125) { TimeStampedPVCoordinates shiftedPV = provider.getPVCoordinates(date.shiftedBy(dt), frame); Vector3D p = model.projectToGround(shiftedPV.getPosition(), shiftedPV.getDate(), frame); pvList.add(shiftedPV); groundPVList.add( new TimeStampedPVCoordinates(shiftedPV.getDate(), p, Vector3D.ZERO, Vector3D.ZERO)); } TimeStampedPVCoordinates computed = model.projectToGround( TimeStampedPVCoordinates.interpolate(date, CartesianDerivativesFilter.USE_P, pvList), frame); TimeStampedPVCoordinates reference = TimeStampedPVCoordinates.interpolate(date, CartesianDerivativesFilter.USE_P, groundPVList); TimeStampedPVCoordinates pv0 = provider.getPVCoordinates(date, frame); Vector3D p0 = pv0.getPosition(); Vector3D v0 = pv0.getVelocity(); Vector3D a0 = pv0.getAcceleration(); return new double[] { Vector3D.distance(computed.getPosition(), reference.getPosition()) / p0.getNorm(), Vector3D.distance(computed.getVelocity(), reference.getVelocity()) / v0.getNorm(), Vector3D.distance(computed.getAcceleration(), reference.getAcceleration()) / a0.getNorm(), }; }
/** {@inheritDoc} */ protected TimeStampedPVCoordinates getTargetPV( final PVCoordinatesProvider pvProv, final AbsoluteDate date, final Frame frame) throws OrekitException { // transform from specified reference frame to spacecraft frame final Transform refToSc = new Transform( date, new Transform(date, pvProv.getPVCoordinates(date, frame).negate()), new Transform(date, attitudeLaw.getAttitude(pvProv, date, frame).getOrientation())); // transform from specified reference frame to body frame final Transform refToBody = frame.getTransformTo(shape.getBodyFrame(), date); // sample intersection points in current date neighborhood final Transform scToBody = new Transform(date, refToSc.getInverse(), refToBody); final double h = 0.1; final List<TimeStampedPVCoordinates> sample = new ArrayList<TimeStampedPVCoordinates>(); sample.add(losIntersectionWithBody(scToBody.shiftedBy(-h))); sample.add(losIntersectionWithBody(scToBody)); sample.add(losIntersectionWithBody(scToBody.shiftedBy(+h))); // use interpolation to compute properly the time-derivatives final TimeStampedPVCoordinates targetBody = TimeStampedPVCoordinates.interpolate(date, CartesianDerivativesFilter.USE_P, sample); // convert back to caller specified frame return refToBody.getInverse().transformPVCoordinates(targetBody); }