EKF class of the EKF section, built on filterpy’s ExtendedKalmanFilter:
The TurtleBot motion model
The straight drive at the start of the EKF section is a special case of the differential-drive motion model of the TurtleBot. As in nonholonomic robots, two wheels of radius sit at distance on either side of the chassis origin. The action is the pair of wheel speeds , which set the forward speed and the turning rate, as derived there from rolling without slipping: With the state and a time step , the motion model and its Jacobian are This model moves the robot along its current heading and then turns it by . It is the first-order approximation of the motion model in EKF localization, which holds the body twist constant over the step and moves the robot along the exact arc, . Expanding that arc in powers of gives The model here keeps the first-order terms and leaves out the terms, a sideways drift that the robot builds up by turning during the step. The two models agree exactly when . The drive below is straight, so its results are the same under either model. The action is in and the state is in , so maps to . The EKF holds the action at its given value and differentiates with respect to the state only. In the notation of the Jacobian note of the EKF section, the map is from to , so and is . The derivative with respect to the two wheel speeds is a matrix. The EKF localization section uses it to turn wheel-speed noise into motion noise. Let the robot start at the origin and drive straight down the page, , with its heading known only roughly. The heading is uncertain even when every sensor works as specified: wheel slip and small errors in the wheel radii add heading error at every step of odometry, the gyro’s bias integrates into a heading drift, and after startup, or after the robot is carried to a new spot, it has no heading reference until it sees a landmark. Write the heading as , where is the heading error. The figure shows where the robot ends up.Sampled and EKF predictions
The code below uses the geometry of a TurtleBot3 Waffle and drives it straight down the page at 0.25 m/s for 4 s, starting from a belief that knows the position to 2 cm but the heading only to . It predicts the new pose twice: by pushing samples of the starting pose through , and with one prediction step of theEKF class above. To isolate the effect of the heading, the motion noise is left out.
Before looking at the result, evaluate at and decide how much of the heading uncertainty the EKF passes into the sideways coordinate and how much into the forward coordinate .
Found an error on this page? Report an issue.

