Ask Your Question
1

Custom Costmap2D Layer is not updating

asked 2017-07-23 01:26:14 -0500

9a3eedi gravatar image

I've been following this tutorial to understand how I can come up with my own layer for Costmap2D http://wiki.ros.org/costmap_2d/Tutori...

I finished doing the first part (i.e. the "Simple Layer" without the grid) and attempted to run it. So I wrote a launch file to start it.

<?xml version="1.0"?>
<launch>
    <rosparam file="$(find my_package)/config/costmap_params.yaml" command="load" ns="/costmap_2d_node/costmap" />
    <node pkg="costmap_2d" type="costmap_2d_node" name="costmap_2d_node" />
    <node pkg="tf2_ros" type="static_transform_publisher" name="static_transform" args="0 0 0 0 0 0 map base_link" />
</launch>

With the following yaml file for the Costmap parameters. As you can see, my layer is the only layer I'm loading (and I want it that way).

plugins: 
  - {name: MyLayer, type: "MyNamespace::MyLayer"}
publish_frequency: 1.0
footprint: [ [-0.325, -0.325], [-0.325, 0.325], [0.325, 0.325], [0.46, 0.0], [0.325, -0.325] ]

The layer correctly starts and I can see this using a ROS_ERROR() statement I added in the onInitialize() function. I also noticed the reconfigureCB() function getting called. However, that's all I'm getting. The updateCosts() function isn't getting called. I was expecting it to be called, and add a cost to the front of base_link. But whenever I read the costmap data from /costmap_2d_node/costmap/costmap topic, all I get are zeros, which means that it's not working.

Is there something else I need to do to get the Costmap to update? Or is there something fundamental about Costmap2D that I didn't understand yet?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2017-07-24 01:17:45 -0500

mgruhler gravatar image

do you have any sensors or anything actually adding stuff to the costmap? If there is nothing in it, the costs will always be 0...

edit flag offensive delete link more

Comments

I do not, but the tutorial code is supposed to put a cost manually in the robot's cell when the updateCosts function is called. The only layer in the costmap is the tutorial code layer. I should at least see something even without any sensors

9a3eedi gravatar image 9a3eedi  ( 2017-07-24 01:43:01 -0500 )edit
1

Hi, it turns out that you are correct. The costmap will not run if there are no messages being published to any of its subsrcibed topics. If your plugin is the only one running in the costmap, then you need to subscribe to at least one topic in order for it to do something. Can you post an answer?

9a3eedi gravatar image 9a3eedi  ( 2017-08-09 00:51:28 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2017-07-23 01:26:14 -0500

Seen: 522 times

Last updated: Jul 23 '17