seeking clarity regarding the 'world_frame' parameter in ekf_localization node

I have spawned two husky bots (namespaced husky_1 and husky_2) in the Gazebo world. I am using two ekf_localization nodes (from the robot_localization package) to produce the husky_1/odom -> husky_1/base_link and husky_2/odom -> husky_2/base_link transform.

The ekf_localization node loads the parameters from a localization.yaml file.

This file has 2 parameters named odom_frame and world_frame. I understand what I need to set as odom_frame.

I am seeking clarity regarding what needs to be go in the world_frame parameter - when should we use odom and when should we use map?

edit retag close merge delete

Sort by » oldest newest most voted

Strictly, per rep-105, the odom frame must be continuous whereas the map frame does not need to be. This is also explained by Tom Moore himself in his talk about robot_localization (around ~4:21)

more

exactly this. Problem with map as the world frame is, that the transformation between map and odom can jump based on localization algorithms.

( 2021-02-22 11:03:42 -0600 )edit

@Akhil Kurup what is the difference between the map_frame and the world_frame? If we are running a turtlebot simulation in Gazebo, what would be the values of map_frame and world_frame ?

( 2021-02-22 13:09:19 -0600 )edit

Agreed on your point, but is this what the question asked for?

( 2021-02-22 13:21:23 -0600 )edit

@skpro19 take a look at the examples in their gihub repo They have a complete section about when you need to set which frame.

And like @JackB said u use /map for the world frame only if you want robot_localization to build the map->odom transform (This is usually the case when using gps). Then something else needs to build odom->base like another robot_localization instance with different inputs (like encoder, imu etc.).

Map_frame odom_frame and base_link_frame gives robot localization the base structure like defined in rep105, meaning map is the fixed frame that contains your map, odom is the frame where your robot publishes the odometry data base_link is obviously the base of your robot to which most sensors will be attached.

The additional world_frame specifies the frame to which robot_localization builds the transform and in your case probably odom

( 2021-02-22 15:38:06 -0600 )edit

@skpro19 the map frame and the world frame "can" be the same for a turtlebot sim in gazebo, but this depends on your application. Unfortunately, without knowing your use case, I cannot give you a generic answer. In larger applications, ones using GPS for example, the world frame can be something like utm whereas the map frame is the gps frame and the odom frame can be from robot_localization (continuous fusion).

@JackB I believe the last part of the question when should we use odom and when should we use map? is asking for clarification on when either frames are being used.

( 2021-02-22 16:09:07 -0600 )edit

It should be odom when when you want to generate the odom->base_link tf and it should be map when you want to generate the map->odom tf.

This is spelled out in the docs.

Cheers! JB

more

Would be there be a difference in the transform published by the ekf_localization node in the two cases? What I mean is, would the ekf_localization node publish odom ->base_link transform in one case, and map -> base_link transform in the other?

( 2021-02-18 10:34:39 -0600 )edit

By convention you should never publish map -> base link directly. I answered that exactly in my answer.

It should be odom when when you want to generate the odom->base_link tf and it should be map when you want to generate the map->odom tf.

( 2021-02-18 10:36:18 -0600 )edit
1

The docs say the following about the publish_tf parameter -

If true, the state estimation node will publish the transform from the frame specified by the world_frame parameter to the frame specified by the base_link_frame parameter. Defaults to true.

So, if we set the world_frame as /map, then the ekf_localization node would (by default) publish the /map -> /base_link transform.

( 2021-02-19 09:23:34 -0600 )edit
1

That is a very good point. I could be 2000% wrong, but in my experience that is not how it works OR is intended to work. I made a PR to the docs That either is correct, or will get rejected with an explanation that makes clear what actually happens or why it works this way.

( 2021-02-19 09:43:49 -0600 )edit
• There's also a map_frame parameter defined in the docs. I understand that it doesn't need to be used when we are operating our bot in the odom frame.

• What happens in the case of navigation using a map? Do we need to define both the map_frame and the world_frame parameters? If yes, do we set both of them to map ?

( 2021-02-19 10:23:32 -0600 )edit
1

@skpro19 see the updated docs regarding the publish_tf parameter.

( 2021-02-22 07:59:24 -0600 )edit

@JackB okay :-) So, if we have set the world_frame as map_frame, we would need to use another instance of ekf_localization to produce the odom -> base_link transform?

( 2021-02-22 13:06:57 -0600 )edit

Also, I think, I would post a new question seeking clarification regarding world_frame vs map_frame parameters in the case of ekf_localization.

( 2021-02-22 13:07:52 -0600 )edit