There is a literature on Constrained Kalman Filters, as an example of one of 625 hits in IEEE Explore:
S. J. Julier and J. J. LaViola, "On Kalman Filtering With Nonlinear Equality Constraints," in IEEE Transactions on Signal Processing, vol. 55, no. 6, pp. 2774-2784, June 2007.
doi: 10.1109/TSP.2007.893949
Abstract: The state space description of some physical systems possess nonlinear equality constraints between some state variables. In this paper, we consider the problem of applying a Kalman filter-type estimator in the presence of such constraints. We categorize previous approaches into pseudo-observation and projection methods and identify two types of constraints-those that act on the entire distribution and those that act on the mean of the distribution. We argue that the pseudo-observation approach enforces neither type of constraint and that the projection method enforces the first type of constraint only. We propose a new method that utilizes the projection method twice-once to constrain the entire distribution and once to constrain the statistics of the distribution. We illustrate these algorithms in a tracking system that uses unit quaternions to encode orientation
keywords: {Kalman filters;filtering theory;pseudonoise codes;statistical distributions;Kalman filtering;distribution statistics;nonlinear equality constraints;projection method;pseudo-observation;state space description;unit quaternions;Chemical reactors;Computer science;Filtering;Kalman filters;Kinematics;Physics;Probability distribution;Quaternions;State-space methods;Statistical distributions;Kalman filtering;measurement matrix;nonlinear constraints;quaternions},
URL: http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=4203082&isnumber=4203033
but probably more useful to you,
https://www.mathworks.com/matlabcentral/linkexchange/links/2191-kalman-filtering-with-state-constraints-a-survey-of-linear-and-nonlinear-algorithms-tutorial
There are many possible approaches.