Ask Your Question

Revision history [back]

Do you need your EKF coordinates to match the coordinate frame of Gazebo?

The issue is just one of timing. If you don't supply an initial state, the first measurement you receive is used to initialise the filter. When you start with just odom data, the first measurement the filter gets puts the state estimate where Gazebo says it is.

When you add the IMU, my guess is the filter receives an IMU measurement before an odometry measurement. Since the IMU doesn't have pose data, it initialises the filter to a (0, 0) position, but with the given orientation.

Anyway, once you receive some odometry measurements, the filter should still move to the odometry pose, though it may take a few measurements.

If it were me, I'd not worry about whether the coordinate frame from Gazebo matches the EKF one. I'd just fuse wheel encoder and IMU _velocity_ data. The filter will always start at the origin, but it'll be consistent.