Custom Costmap2D Layer is not updating
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?