# robot_localization: how to set covariance matrix [closed]

I am using robot_localization to integrate odometer, IMU and GPS data on a Clearpath Husky robot. 2 ekf_localization_node were used to create map->odom->baselink frame transformations. Everything works fine except one problem:

The error of filtered GPS data was accumulating. The positioning error can quickly reach more than 10 meters after several miniutes, which is even a lot bigger than the GPS error itself. It doesn't make sense to me.

So I am suspecting that it might be the problem of initial covariance matrix of measurement. I did not set up the covariance matrix, so I am guessing the ekf_localization_node was using a default matrix. How can I correctly set up the covariance matrix? (say the GPS std is 3 meters).

Below is the path of my robot, the figure shows the filtered GPS data. The robot started from thr right bottom connor of the building and returned to the same location. However, the filtered GPS data showed the robot in a very wrong positon (in the building)

Not sure how I missed this question. Can you post sample messages for all inputs and outputs?