Ask Your Question

Revision history [back]

Issue 1

when the robot stands still, position x an y of odometry from robot_localization will still move a bit.

That's because you are fusing X and Y linear acceleration from your IMU, and that data will be very noisy and (in this case) strongly non-zero:

linear_acceleration: 
  x: 0.209036067128
  y: -0.0059831100516
  z: 9.8041009903

Issue 2

In my bag, I make the robot move forward 8m, but the result is about 7.91m. I think the error is too big and the imu has little effect. So I think my covariance maybe is not fit.

A couple responses here:

  1. All of your IMU covariances are invalid. A covariance matrix must be positive semidefinite, and therefore invertible. You cannot invert, for example, your angular velocity covariance:

    angular_velocity_covariance: [4e-08, 4e-08, 4e-08, 4e-08, 4e-08, 4e-08, 4e-08, 4e-08, 4e-08]
    

    I would make the diagonal values non-zero, and the rest zero. The values also seem a little _too_ low. Are they based on a spec?

  2. I think you might be expecting too much from the filter in this case. It's not magic, so if you feed it bad data, it will spit out bad data. Your IMU, even at rest, is reporting incorrect linear acceleration (assuming you posted an IMU message showing the robot at rest).

    Having said that, I think you could tune your covariances a bit and get some better results, even if you continue to fuse linear acceleration. You need to get accurate (and mathematically sound) covariance values for your IMU data and your wheel encoders. Just as a test, you can try increasing the IMU linear acceleration covariance (just the diagonals - put the rest to 0) and decreasing the wheel velocity covariance. You might also want to play with the filter's process noise covariance. Those values look pretty large to me.