0
$\begingroup$

Rosanswers logo

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?


Originally posted by skpro19 on ROS Answers with karma: 310 on 2021-02-17

Post score: 0

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

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


Originally posted by JackB with karma: 977 on 2021-02-18

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by skpro19 on 2021-02-18:
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?

Comment by JackB on 2021-02-18:
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.

Comment by skpro19 on 2021-02-19:
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.

Comment by JackB on 2021-02-19:
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.

Comment by skpro19 on 2021-02-19:\

  • 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 ?

Comment by JackB on 2021-02-22:
@skpro19 see the updated docs regarding the publish_tf parameter.

Comment by skpro19 on 2021-02-22:
@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?

Comment by skpro19 on 2021-02-22:
Also, I think, I would post a new question seeking clarification regarding world_frame vs map_frame parameters in the case of ekf_localization.

Comment by JackB on 2021-02-22:
Yes exactly, you need two instances of the EKF node. This is implied in my answer, and well documented in the package documentation. Cheers

$\endgroup$
0
$\begingroup$

Rosanswers logo

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)


Originally posted by Akhil Kurup with karma: 459 on 2021-02-22

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by Tristan9497 on 2021-02-22:
exactly this. Problem with map as the world frame is, that the transformation between map and odom can jump based on localization algorithms.

Comment by skpro19 on 2021-02-22:
@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 ?

Comment by JackB on 2021-02-22:
Agreed on your point, but is this what the question asked for?

Comment by Tristan9497 on 2021-02-22:
@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

Comment by Akhil Kurup on 2021-02-22:
@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.

$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.