Thanks for the detailed overview. I wish to work in real life situation and i know that my sensor updates the data at 0.25s and it has an uncertainty of +-0.3m. Choosing a value and working with robot_localization, i want to see how much this uncertainty grows with time.. Two things that are still confusing me. Is 0.3 is right value for this situation? 2, i will provide the initial value only, manually, then robot_localization calculate /predict the future values? or how will it behave?

OK, so the per-measurement uncertainty of 0.3 m should be encoded in your covariance matrix. The difficulty is in interpreting what "+/- 0.3m" means. Does that represent one standard deviation, or more? I'd suggest over-estimating the error in general, as probabilistic approaches seem to be more robust to over-reporting error than under-reporting. Also, is it 0.3 meters in the position estimate, or 0.3 meters in both X and Y?

If we assume it's overall position error and it's one standard deviation, and we assume equal error in X and Y, then you might do

```
x_error^2 + y_error^2 = 0.3^2
2 * x_error^2 = 0.09
x_error = 0.212132034355964
```

But that would be standard deviation. You want variance, so you have to square again that to get `0.045`

. That value should go in the XX and YY entries in you covariance matrix (0th and 7th index of the covariance vector in the message.

I didn't think about this too deeply, so there may be a better way to interpret that data, but it's a start.

Between position measurements, the EKF will predict where you are, and then correct that prediction with your measurement. However, I hope you have something measuring yaw or yaw velocity, or your state estimate will get very ugly very quickly.

Are you aware of what the covariance matrix represents? Basically, during localization you are uncertain of a lot of things. You don't have perfect odometry, your sensor data is noisy, you could make "wrong" detections. The covariance matrix describes the "uncertainty" in different directions. Where a bigger value in the matrix indicates that you are more "uncertain" about your pose. Depending on what localization method you use, how good your sensors are, how much drift your robot has, your change in covariance will be different. Suppose the following 1D example. We have a robot that when we tell it, it has to move 1 meter, it can move either 95 cm or 105 cm. After 1 meter the covariance is 5 cm, because the robot could be at any point between 95cm and 105cm. If we move 2 meters, the covariance increases to 10cm (the robot could now be ...(more)

Covariance can decrease by adding sensors or any other information. Suppose we add a sensor to the previous example that can tell where the robot is within 1cm. Whenever you get a sensor update you can reduce the covariance to 1cm. I.e. the sensor tells you the robot is at 97cm after the first motion. You know at that point that the robot is somewhere between 96cm and 98cm (instead of the previous 95cm to 105cm).

I understand that this does not directly answer your question, but it gets you an idea of how you would have to obtain a proper covariance matrix. You can make estimates on what the values should be or you could determine values empirically. Alternatively look around and see how other people obtain and update their covariance matrices. Note that if you are working in a simulated environment, then you can have a covariance of 0. However, if you ever wish to apply your code to a real life situation it will probably not perform as expected (it is recommended to add noise on your simulated sensors). If you add noise to your sensors or odometry then you can derive your covariance from the noise (the noise corresponds to your uncertainty).

Thanks for the detailed overview. I wish to work in real life situation and i know that my sensor updates the data at 0.25s and it has an uncertainty of +-0.3m. Choosing a value and working with robot_localization, i want to see how much this uncertainty grows with time.. Two things that are still confusing me. Is 0.3 is right value for this situation? 2, i will provide the initial value only, manually, then robot_localization calculate /predict the future values? or how will it behave?