# robot_localization: how to define f function

Hi to all,

I'm using and studying the robot_localization package in order to integrate it with my system. At the moment, I would like to better understand how it works and so I've read the Thomas Moore's article and I also watched the video presentation.

Unfortunately, I can't understand how the function f is described in the following relation:

How it is possible to mathematically define the function f and Q?

Can you help me in understanding this, please? I know it's maths and that it is not related to ROS, but I think that it is very important to understand these functions for me.

Thank you!

Originally posted by Marcus Barnet on ROS Answers with karma: 287 on 2016-10-17

Post score: 0

Comment by Marcus Barnet on 2016-10-17:
I've read this topic, but I would like to have an example on how to write the full f function, if possible.

Comment by Marcus Barnet on 2016-10-17:
May be, I've found the state transition matrix described in this way. But I can only see 9 components for the vector and not 12 as specified in the article. Why?

Comment by Tom Moore on 2016-12-19:
An EKF is estimating the state of something. It's up to the author to determine which variables to estimate. The link you provided is just estimating a different set of variables. Specifically, it appears to lack orientation and angular velocity.

This would be a good question for the Robotics Stack Exchange. Briefly, the function f is a vector-valued function that takes as its input the entire state vector x_t-1, and outputs a state vector x_t. In this case, even though it's a single function in the paper, we can really express it as a set of functions like this:

X = X + X_velocity * time_delta + X_acceleration * 0.5 * time_delta^2

Y = Y + Y_velocity * time_delta + Y_acceleration * 0.5 * time_delta^2


...etc. The only difference from what I have written here is that we have to rotate both the velocities and accelerations by the robot's orientation, since those quantities are given in the robot's body frame.

Originally posted by Tom Moore with karma: 13689 on 2016-12-19

This answer was ACCEPTED on the original site

Post score: 0