I am trying to implement a corner of the nav2 stack on a robot. What i am interested in, is using the costmap_2d package, to keep track of incoming obstacles in a local costmap, by rolling it infront of the robot.
Currently, i am using the nav2_costmap_2d node, and running it with:
ros2 run nav2_costmap_2d nav2_costmap_2d --ros-args -p rolling_window:=true -p height:=5 -p width:=5 -p resolution:=0.1 -p global_frame:=odom
This correctly spawns a costmap for me, that i can visualize in RVIZ. I can also call the /costmap/costmap_updates to insert values into the map, which then changes color of the cells in rviz. My problem is that whenever the costmap updates, all the cells that i have filled through the update topic disappears. Furthermore, when i echo the /costmap/costmap_raw it always displays 0, 0, 0, 0 etc. in data, never reflecting that i have actually updated the costmap. I have tried to enable that with setting always_send_full_costmap to true, but this does not work either.
How can i get the costmap to function properly?