rlabbe / filterpy

Python Kalman filtering and optimal estimation library. Implements Kalman filter, particle filter, Extended Kalman filter, Unscented Kalman filter, g-h (alpha-beta), least squares, H Infinity, smoothers, and more. Has companion book 'Kalman and Bayesian Filters in Python'.
MIT License
3.23k stars 614 forks source link

Bounded solutions for Kalman Filter Estimates #220

Closed mbronzo closed 3 years ago

mbronzo commented 3 years ago

Hi to everyone! First of all I would like to thank you a lot for the amazing work done, it was incredibly useful, even for someone like me, inexperienced about the topics. My issue regard the possibility of bounding the estimates of x so that each term in the vector is non-negative, as my real life variables should not be negative. I have seen different ways to tackle this issue, one resorted to the Extended version of the filter associating to the original state x an augmented state that uses a sigmoid function. Nevertheless I have seen the possibility of implementing such constraints in the original version of the Kalman Filter ("Kalman filtering with state constraints: a survey of linear and nonlinear algorithms", D. Simon[2009]). I was wondering whether there is any possibility of implementing such constraints in the Kalman Filter directly from the Filterpy library, and in case there's not, if you could suggest which way I should go for.

Thank you again for your time and patience.

mbronzo commented 3 years ago

I solved this issue, thanks again for the amazing library!

wqp89324 commented 2 years ago

@mbronzo how did you solve this issue?

mbronzo commented 2 years ago

@wqp89324 I restated the initial linear constrained model into a non linear one and used the Unscented Kalman Filter. Not sure can be done in any case but for my model specification a softmax did the job.