Hi guys :)

I'm trying to fuse an odometry source with the data coming from an IMU. To do this I'm using robot_localization. I'm having difficulties to understand how to set the covariance matrix for the IMU. At the moment I have a covariance matrix filled with zeros. As you can read from here (http://docs.ros.org/kinetic/api/robot_localization/html/preparing_sensor_data.html) this is an error:

-> Missing covariances. If you have configured a given sensor to fuse a given variable into the state estimation node, then the variance for that value (i.e., the covariance matrix value at position (i,i), where i is the index of that variable) **should not be 0**. If a 0 variance value is encountered for a variable that is being fused, the state estimation nodes will add a small epsilon value (1e−6) to that value. A better solution is for users to set covariances appropriately.

Ok, so let's set the covariances appropriately. I think I only have two options: calculate it or get the values from the datasheet.

So, let's look at the datasheet. I'm using the X-NUCLEO-IKS01A1 board with LSM6DS0 IMU. The datasheet is here https://www.st.com/resource/en/datasheet/lsm6dso.pdf . As you can see there's a table on page 9 that talks about noise, like 'Gyroscope RMS noise in normal/low-power mode', etc. But how can I relate these values to variances? I didn't find anything on the web apart from this answer here https://robotics.stackexchange.com/questions/1449/how-are-units-of-noise-measurement-related-to-units-of-a-sensors-data-measureme where they say: "If you haven't got a background in random processes and signal analysis then you're going to have a rough time relating this back to real-world numbers, particularly if you're doing any kind of sensor fusion. Even the "big boys" in the sensor fusion game can't easily map sensor noise to system behavior without lots of simulation and head-scratching."

The other option is to calculate it. Again, I didn't find any standard approach to do it. I came up with the idea to just collect data for a while placing the IMU in a very firm way, then calculating the variance (so assuming the covariance matrix diagonal). Does it make sense an approach like this?

Moreover, do you know if there's a standard approach to set the covariance matrix? What's the complete spectrum of the alternatives?

Thanks