# State-vector for distance measurement between two autonomous cars

I hope someone can help me: Given two autonomously driving cars, I want to make sure they keep a constant distance to each other. For this purpose, I want to design a Kalmanfilter. Typically, the first step for designing such a filter is to set up a state vector. I am given two robots already. They have an ultrasonic-sensor to measure distance and an encoder to measure velocity. However, what is not clear to me is: What would be the proper state-vector for my Kalmanfilter equations?

I have troubles understanding this, because, from the tutorials I have read, I got the impression a Kalmanfilter always combines at least two Gaussian distributed measurements. In order to compute a new distance for example, I would have to compute ... I don't know, maybe this: Does somebody know?

Kalman filter can be used to estimate the position of each car independently since there is no communication between two cars. In that case the most suitable parameters for the state vector is [Px Py $$\theta$$]. $$\theta$$ represents the heading direction. You can also include the X and Y velocities according to your requirement. In order to maintain a constant distance you can get the euclidean distance between the X and Y states of the two kalman filters.