Kalman Observer and RtsSmoother Information Retrieval

Hello everyone :slight_smile:

I’ve recently been trying (again) to use the RtsSmoother in my orbit determination method, but I’ve run into a few issues I’m not sure how to tackle.

I use a custom PythonKalmanObserver to retrieve information from the Unscented Kalman process when I’m not using the RtsSmoother. However, when I want to use the smoother, I have to set it as the observer (estimator.setObserver(smoother)). I thought it would be easy to get the same information from the smoother object as I do from a normal observer, since it is one, but I can’t access any of the data that a typical KalmanEstimation object holds. For example, estimation.getCurrentDate(), estimation.getPredictedMeasurement(), estimation.getEstimatedPropagationParameters()

Basically, I’d like to get all that data for both the forward pass and the final smoothed state. My goal is to plot the error between the true and estimated orbit, and the measurement residuals. So what I really need to plot are the results from the smoothed state, not the forward pass. But from the smoother, I can only get the PhysicalEstimatedState (which I’ve already discussed in another topic with @baubin and @markrutten).

I also tried setting two observers to at least get the information from the forward pass before doing the smoothing, but that didn’t work and the smoother failed.

For the smoothed measurements residuals, I even thought about using the smoothed PhysicalEstimatedStates to generate artificial measurements from that orbit, but that seems incredibly tedious.

Any help would be much appreciated :smiley:
Antonio Malaver

Could you perhaps create a custom child class of RtsSmoother with the functions to pull the data you need, and then use that as your observer? Otherwise I’m afraid that the only other solution I can think of is to work with the Java source code and alter the RtsSmoother code directly. Though in the long term I do think adding more ability to pull interim data out of the standard filter/smoother classes would be a good thing to add to the standard library.

Isn’t there a way to use two observers in the Kalman filter? At least, to let RtsSmoother let do what it internally does and retrieve the information from (at least) the forward pass of the filter.

Thank you so much in advance,
Antonio Malaver.

Hi,

you can create your own observer that in turn calls several other ones.

Cheers,
Romain.

1 Like

Thank you @Serrof. I tried doing it with a new Python class named MultiObserver that was an Observer itself that received a list of observers and at each step updated all the observers calling the evaluationPerformed() methodolody. Nevertheless, the RtsSmoother seems to dislike that because whenever I call RtsSmoother.backwardsSmooth() it returns an error as if no observations were added to the smoother (although in the other smoother I add all the data is correctly stored).

On the other hand, @markrutten: is there a way to obtain from the RtsSmoother internal observer the forward information from the forward pass? This is, all the information from each KalmanEstimation:

If I can retrieve from the RtsSmoother all this information from the forward pass it would be of tremendous help, as I think I cannot get it for the backwards pass. But in the future it may be ideal to also get all of this information from the smoother, such as the residual from the real measurement and the corrected by the smoother (this is, the measurement the sensor would read in the final position predicted by the smoother at each t_k).

I tag you @markrutten as you were the one implementing this feature. Sorry for insisting so much.

Thank you so much,
Antonio Malaver.

Hi @a.malaver, @Serrof ‘s answer is the right way to go. The Kalman estimator doesn’t support more than one observer, so you need to make your own observer that calls the smoother observer and then records what you need from the KalmanEstimation. It’s a little bit clumsy but was a deliberate design choice.

There is no equivalent to an observer on the backward pass. As you know, the RTS smoother doesn’t need access to the measurements, so storing, then calculating, all the info required to populate a KalmanEstimation would be a significant overhead. If you think it would be a common use-case, then feel free to lodge an issue on the gitlab.