Stone-Soup icon indicating copy to clipboard operation
Stone-Soup copied to clipboard

Issue with track fusion using Particle Filters

Open A-acuto opened this issue 2 years ago • 1 comments

Hello, I've been trying to set up a comparison code using track fusion algorithm between Kalman and particle filters. The track fusion seems working fine using the tracks obtained with the Kalman filter, but in the case of Particle filter there is an incompatibility issue between the Gaussian detections and the ParticleStateUpdate, in particular using Tracks2GaussianDetectionFeeder I got this error from types/detection :

super().__init__(state_vector, *args, **kwargs)
TypeError: __init__() missing 1 required positional argument: 'covar'

Example using the kalman filter: here Example using the Particle filter: here

Thanks for any input on this issue

A-acuto avatar Sep 12 '23 11:09 A-acuto

Tracks2GaussianDetectionFeeder is designed for Gaussian based states only, as well as Chernoff Updater being used. Another approach, not currently implemented would be need to fuse ParticleState.

With small modification, it would be possible to take the ParticleState mean and covariance and assume the ParticleState is representing a GaussianState. We could make change to support that.

diff --git a/stonesoup/feeder/track.py b/stonesoup/feeder/track.py
index a157f4d5..37f2aebe 100644
--- a/stonesoup/feeder/track.py
+++ b/stonesoup/feeder/track.py
@@ -27,6 +27,8 @@ class Tracks2GaussianDetectionFeeder(DetectionFeeder):
                 detections.add(
                     GaussianDetection.from_state(
                         track.state,
+                        state_vector=track.mean,
+                        covar=track.covar,
                         measurement_model=LinearGaussian(
                             dim, list(range(dim)), np.asarray(track.covar)),
                         metadata=metadata,

sdhiscocks avatar Oct 05 '23 14:10 sdhiscocks