Rosanswers logo


I’m working on a custom built robot and I’m trying to position the robot in known map as well as control it in order to go from A to B. I found robot localization to be exactly what I need for my project but I have some issue with understanding how robot localization works (I read most of forums posts on ROS.org but cannot find explicit answer to my concerns). To be more precise I’m having trouble understanding which node instance output to use for localization in case of two EKF instance example (odom or map)?

I am fusing wheel encoder and IMU in odom frame, and also in another instance of robot localization EKF node I am fusing wheel encoder, IMU and UWB in the map frame. I’m using UWB instead of GPS - I have this with guaranteed 3Hz update rate and it supplies x and y coordinates in world frame. As a result, I have two estimates of the robot’s position in two resulting frames (map and odom). As I understand, the map -> odom transformation is constantly being computed and published and is not constant due to a drift in odom frame, and discrete jumps in map frame. I also understand (from forum posts) that odom frame output is continuous and thus better suited for control. Is there any example of how to integrate robot localization in control loop?

The question is which data to use for localization? Are the two frames in any way connected/communicating in the background (except for transform update)? Due to 3Hz update rate could I get away only with odom frame output (other sensors have 25Hz update rate) which would also include UWB readings?

I would greatly appreciate any help of pointers in the right direction. Thank you in advance.

Best regards,

Originally posted by Double X on ROS Answers with karma: 17 on 2015-12-17

Post score: 0


1 Answer 1


Rosanswers logo

I find it's better to think about them as totally separate. In reality, both filters are doing the same thing: estimating your pose in some world frame. The map and odom frames are similar in that they are both global frames, so in a perfect world, your pose would be the same in both. What the odom and map filter instances are doing is creating transforms from odom->base_link and from map->base_link, respectively. tf represents your transforms as a tree, though, so we can't have two parents to base_link. To get around this, the map instance of ekf_localization_node looks up the transform from odom->base_link that the odom instance of the EKF is generating, and uses that transform, along with its own (internal, unpublished) map->base_link transform, to generate a map->odom transform. This means you can still transform from map->base_link in other nodes that may require it.

As to what you do with each estimate, that's up to you. If you want the most accurate answer to the question "where is my robot?", then I would use the map instance output. If you want a pose estimate that is not going to suddenly jump, then you want the odom instance.

Originally posted by Tom Moore with karma: 13689 on 2016-02-05

This answer was ACCEPTED on the original site

Post score: 4

Original comments

Comment by Double X on 2016-02-10:
Thnx for answering :) the problem is solved

Comment by josephjoel3099 on 2022-07-19:
This makes perfect sense. Thanks


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.