# How can I get ICP covariances using laser_scan_matcher?

In scan_tools laser_scan_matcher there's a parameter called **do_covariance_computation** which makes laser_scan_matcher calculate covariances but not publish them.

I would like to get the covariances of the ICP, since there's no topic published for this I am trying to get them adding some code to the laser_scan_matcher. At the moment I am adding this

```
std::cout << "cov_x_m: " << output_.cov_x_m->size1 << " " << output_.cov_x_m->size2 << std::endl
```

Doing so I get the following:

```
...
cov_x_m: 3 3
cov_x_m: 3284753240 3220715007
cov_x_m: 3 3
cov_x_m: 3284753240 3220715007
...
```

If I print the data when size is 3x3 I get something like:

```
...
cov_x_m: 3 3 COV: -0 0.00218628 0.00205292 0.000400059 0.000501095 -0.000222392 -0.00112383 0.000397344 -0.000885956
cov_x_m: 3 3 COV: 0.000150193 0.00153727 0.00446424 -0.0020142 0.000833389 0.000602156 -0.00217345 0.00121861 -0.00240148
...
```

My questions are:

- Is this the right way to get this information?
- Why the covariance sizes are not always 3x3?
- Is normal that these covariances are so similar to 0?

Thanks in advance

did you find answer for your problem ?

This is quite old but I suppose so, at the end I used the code: covariance[0] = gsl_matrix_get(output_.cov_x_m, 0, 0); to get an element of the 3x3 matrix.