Skip to content

Extended Kalman Filter (EKF) Results

April 22, 2013

We bagged data of autonomously navigating to three GPS waypoints this past Friday. To better understand how our EKF implementation performs, we ran several EKFs offline at the same time, and had them listen to different combinations of the updates being played back in the bagged data.


This is a plot of the raw GPS data we collected, plotted using the Google Maps API. In reality, the robot drove practically straight to each waypoint, wavering slightly.

All of the charts below were drawn in a browser using Javascript to render on HTML5 canvases. You may question the process here, asking “Oh God why would you use Javascript?” The answer to this is that we had to use a browser anyway in order to use the Google Maps API, as seen above. So, why not use rosbridge to expose ROS topics to the network, listen to the Kalman filter updates along with raw GPS data, and plot them along side each other in real time?! In addition, we’ve found that using mjpeg_server in ROS and displaying mjpegs on client webpages is a much better way of viewing live camera data than X-forwarding the image_view ROS node window. Also, I really like Javascript.

By using the browser to display data, we can view stuff streaming from the robot to a web portal without requiring an SSH session, and enable it to be viewed from anywhere in the world. Even India, for example! Which is surprisingly relevant, since it appears that this blog has gotten more hits from there than anywhere else in the world combined.

NOTES ON THE CHARTS: each point plotted below uses a colored circular point and a white line stemming from the point to indicate direction. The points and white lines are plotted one on top of the other. The hue of the circles vary with time, so since there are so many points, the charts appear to display smooth psychedelic transitions of the rainbow. Each square on the charts are 4 by 4 meters wide.


Chart 1: This is the EKF’s output given only the processed GPS data. By “processed data” I mean the raw data converted to x/y meters, using an arbitrary GPS location near by as an origin. No other filtering is applied.

Notice that in the plot above, the Kalman filter does a miserable job of tracking the robot’s heading, especially at the beginning. We believe that this is valid behavior, since the filter could easily explain our scattered position updates by believing that the robot was moving backwards and spiraling, having no angular or linear velocity updates to think otherwise. When the robot isn’t moving on the x-y plane, the EKF is left to believe whatever it would like about which direction the robot is facing, since it has no information on the subject.

When combined with the encoders, which we use to get angular and linear velocity updates, the plot (Chart 2) is much cleaner. We used these updates to the EKF when the robot took this path autonomously:


Chart 2: This is the EKF plot using GPS x/y updates plus encoder angular/linear velocity updates.

What’s really nice about Chart 2 is that it shows reasonably estimates of direction without using an IMU. This means that if the power generators at the competition introduce errors in the magnetometer which cannot be compensated for, we’ll still be okay. However, if we use compass updates that are not erroneous, rather than encoders, we get something a lot smoother:


Chart 3: EKF output using GPS updates plus the IMU’s yaw updates

The plots above use GPS to globally localize. Not using a global position update would lead to the EKF’s position estimate to incur error over time and drift. Similarly, use of the IMU’s yaw value can give us a global heading update. As seen in chart 2 above, without global directional updates, the EKF can still estimate global heading by using global position updates. (As if it were connecting dots and noting then observing the direction of the connecting line.)

It would be interesting to see what happens without either global position or orientation updates. Updates from the encoders come in the form of position and orientation derivatives: linear and angular velocities, which are based on the robot’s initial reference frame, not the global reference frame. Using only these updates, we would expect quite a bit of drift with both direction and position, because any slippage in sliding of the wheels would cause erroneous [non-Gaussian, mind you!] updates. However, it turns out that it isn’t so bad, as you can see in Chart 4:


Chart 4: EKF output using encoders only

In fact, it looks pretty good! The drift appears to be small (within 2 meters). In reality, we probably just got lucky. If the wheels had slipped at all on the field, we would not be seeing such pretty data–in the past, we have seen slippage mess this plot up quite a bit. Notice that the path above starts at the origin since the EKF initialized with a (0,0) position, and there is no global position update to tell it otherwise. The path also appears to be rotated from the other plots. This is because the EKF is initialized with a direction of 0 radians, and there is no global orientation update to tell it otherwise.

We observe some odd behavior when including a global directional update with the encoders (again lacking GPS updates). It appears that there is more positional drift with orientation updates than without, as you can see here in Chart 5:


Chart 5: EKF output with only encoders and IMU orientation updates

We’re still trying to explain this. It could have something to do with the fact that the yaw update appears to be slightly offset by about 10 degrees counter-clockwise, as can be seen with comparing this to the raw GPS data given at the top of this post.

Despite this, we can bask in the beauty of combining all updates into one, cohesive, glorious state estimation, which appears to be qualitatively reasonable:


Chart 6: EKF output using encoders, GPS, and IMU orientation updates


From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: