# 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?

## 2 Answers

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.

I'm not sure what distance you are trying measure using the ultrasonic sensor.

• thx very much! I know the Kalmanfilter equations in case I am given Location. However, I am not. I am only given distance through the ultrasonic sensor. I have no possibility to determine my x and y coordinates. – user503842 Jan 15 at 12:10

A Kalman filter can combine multiple sensors, but can also recover information of other states you do not measure directly. For example if you only measure the position the Kalman filter can also obtain a good estimate of the velocity. A naive way for this would be to differentiate the position. However, when the position is subjected to noise, differentiating it will amplify this noise a lot. In such a case a Kalman filter would be able to get a much better estimate of the full state. It does this by trusting more on the model you have of your system.

I do have to note that in order for the Kalman filter to be able to estimate the full state does require that the sensors you have make your system observable.

• Thx, man! In my particular case I measure velocity and distance to the robot in front. From these two sensor measurements, what are the states I can compute? I know I have velocity, I can also compute longitudinal position through integrating my velocity. But what if my robot is driving in a circle? At some point the position will be the same as before... what could be other useful states that I can actually calculate with these two sensors? Acceleration, maybe. – user503842 Jan 19 at 8:18