dstl / Stone-Soup

A software project to provide the target tracking community with a framework for the development and testing of tracking algorithms.
https://stonesoup.rtfd.io
MIT License
384 stars 126 forks source link

Kalman filter not working with 3D groundtruth #845

Closed ColeBromfield01 closed 10 months ago

ColeBromfield01 commented 10 months ago

kalman_3d.txt points2.csv

I'm trying to create a ground truth and measurements with the points in the csv file, and then perform a Kalman filter calculation, but the track ends up blown up every time (see image--track goes way beyond the groundtruth and points) track

How might I fix this issue?

jswright-dstl commented 10 months ago

The orange bars denote the uncertainty in the x,y,z directions. In your image your track uncertainty is very high. I have reproduced your example and get the same results. Are the parameters of sensor location, measurement noise fixed for your example? If not, by changing the location of the sensor, from in the centre of the ground truth to further away produces better tracking performance as does changing the noise covariance in the CartesianToElevationBearingRange measurement model where you have set the Range noise to 1000^2 to something lower.

ColeBromfield01 commented 10 months ago

Thank you for the response! Where in the code do I change the location of the sensor? Sorry, I am still somewhat new to StoneSoup

jswright-dstl commented 10 months ago

In your kalman_3d.txt file, you set the sensor location as the following:

sensor_x = 0 sensor_y = 0 sensor_z = 50

ColeBromfield01 commented 10 months ago

Is there a specific method for figuring out the best initial coordinates to use? I've tried a few and some have made the uncertainty slightly better but still very high

ColeBromfield01 commented 10 months ago

I think I've improved it by changing the sensor position and changing the covar matrix to CovarianceMatrix(np.array(np.diag([np.deg2rad(0.05)2, np.deg2rad(0.05)2, 100]))), but I'm still getting some weird points ( track2 ) and a warning about complex values (ComplexWarning: Casting complex values to real discards the imaginary part return np.asarray(x, float)), Do you know what could be causing that?

I really appreciate all of your help

hpritchett-dstl commented 10 months ago

Hi @ColeBromfield01,

In your dataset there is a lot of "jumping" around by the target, which a constant velocity model doesn't accurately capture. You can see this happening between line 11 and 12 in your data.

Are there multiple "targets" in this scenario, or is it a single target problem?

ColeBromfield01 commented 10 months ago

This is a single target, and it's supposed to be moving in circles. Is there a better transition model to use?

Also is there a way to affect the balance of whether the measured or predicted value is taken more into account in the Kalman calculation?