ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Global frame for global_costmap and local_costmap are different?

asked 2021-12-15 07:18:52 -0500

robotguy gravatar image

Hi everyone,

I followed the tutorial about the navigation stack (

But I have a question, to which I didn't find an answer on the internet. On section 2.3.3, about the local_costmap_params.yaml, it says

-local_costmap: global_frame: odom


-The "global_frame", "robot_base_frame", "update_frequency", and "static_map" parameters are the same as described in the Global Configuration section above.

but then when I read section 2.3.2 about global_costmap_params.yaml, I see

global_costmap: global_frame: /map

I don't understand what should be the global_frame in local_costmap_params.yaml. I would tend to think that it's the same as in global_costmap_params.yaml but the example in the tutorial says the contrary. And given that odom is drifting from map, the tutorial seems to be giving contradicting information.

So my questions are:

-Is the global_frame meant to be different or identical in local_costmap and in global_costmap? -Why?

Thank you,

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2021-12-15 21:06:52 -0500

Mike Scheutzow gravatar image

We set both parameters to the same value: map. I think the parameter gets used if you specify a static_layer or an obstacle_layer for the costmap.

edit flag offensive delete link more


Ok, thank you! Does that mean that the tutorial needs a fix?

robotguy gravatar image robotguy  ( 2021-12-16 02:54:15 -0500 )edit

I don't know, I haven't looked at that tutorial lately. At startup, the map->odom transform is usually Identity, so maybe the tutorial is relying on that fact. Or perhaps the global_frame parameter is no longer used because the information is obtained from somewhere else.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2021-12-16 10:52:56 -0500 )edit

You got me curious. The global_frame parameter is definitely needed by costmap_2d for a bunch of different reasons. Take a look at costmap_2d_ros.cpp in the navigation package if you are curious.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2021-12-16 12:41:21 -0500 )edit

I had a look into it, it indeed seems that the parameter is used for waiting for transform, recompute and publish transforms. Given that map and odom differ quite a lot on in my case (because of my purposedly noisy odom), I don't understand why I still have the same results whether I write map or odom. But anyway, your answer led me to understand what should theoretically happen. Thank you!

robotguy gravatar image robotguy  ( 2021-12-21 09:09:53 -0500 )edit

Question Tools


Asked: 2021-12-15 07:18:52 -0500

Seen: 528 times

Last updated: Dec 15 '21