There was a direct way to retrieve a spacecraft frame, but we intentionnaly removed it because there were some hidden problems that quickly lead to either computation bottlenecks or infinite loops.
The problem was that the
Frame interface enforces that a method
getTransformTo(final Frame destination, final AbsoluteDate date) is available. This means that the frame is not bound to a specific time but should be able to compute autonomously its relationship with any other frame at any time the user wants.
In order to do this, our old
SpacecraftFrame did in fact had a reference to an internal propagator in order to get the position of its own origin.
If you put an analytical propagator in the
SpacecraftFrame and use this frame in another propagation, the results may be inaccurate because analytical propagators are not perfect.
If you put a numerical propagator in the
SpacecraftFrame and use this frame in another propagation, performances may decrease dramatically because you have one numerical propagator hidden in all the internal computations of another propagator. There may also be numerical noise because the underlying propagator works within the steps of the outer propagator.
If you try to use the same propagator inside and outside, you get infinite recursion.
The root of the problem is this
getTransformTo method that should be able to return something meaningful for any date. In most cases, however, we don’t really need this general purpose method. We already known the date (which is the current date from the existing
SpacecraftState). So we don’t need a
Frame or a
TransformProvider, we need only the current
So what we use now is simply a fixed
Transform from spacecraft frame to instrument frame. When we need to compute for example the line of sight of a target in the field of view of the instrument at some current date where we have a
SpacecraftState, we just use
spacecraftState.toTransform() to have the current transform for inertial frame to current time, then combine it with the fixed transfom from the spacecraft frame to the instrument frame and we have the
Transform we want from inertial frame to instrument frame. In other word we don’t use the generic
getTransformTo method between frames, we create our own
getTransformTo that only works at current date.