Skip to content

Fix bug in rolling costmap setup#70

Open
ErikCald wants to merge 2 commits intomainfrom
fix_rolling_costmap
Open

Fix bug in rolling costmap setup#70
ErikCald wants to merge 2 commits intomainfrom
fix_rolling_costmap

Conversation

@ErikCald
Copy link
Contributor

@ErikCald ErikCald commented Feb 9, 2026

I had an issue where both costmaps were flickering out for like 0.2 seconds every second on rviz. It also saw that the planner was planner through obstacles when this happening meaning what I saw was truly the costmap plugin show a fully unknown costmap. When I turn off rolling costmap, the issue goes away. So I'm pretty confident this issue is because the rolling window config is clearing the map and so we need the gridmaplayer plugin to track the costmap state and handle remembering obstacles.

@ConnorNeed can you look through this code and let me know if it makes sense with your knowledge of the costmap plugin system?

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses rolling-window costmap “flicker” by caching the last received GridMap-derived costs in the plugin’s internal costmap buffer and re-merging that buffer into the master costmap every update cycle (even when no new GridMap message arrives).

Changes:

  • Stop gating updateCosts() on has_updated_data_ so the layer contributes every cycle.
  • On new GridMap data, copy interpreted costs into the layer’s internal buffer via setCost().
  • Merge the internal buffer into the master costmap each cycle using updateWithMax() or updateWithTrueOverwrite().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@ConnorNeed ConnorNeed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes complete sense to me.

The only thing I will say is we might still want to guard against writing to master until we have recieved at least one map. That's how it looks like the other plugins do it. In terms of the second AI comment I am okay with throwing and crashing the system with a very detailed error rather than trying to continue without our main vision mapping.

The build machine might not be plugged into the router. I'll plug it back in when I get there tonight but feel free to merge in when you are ready.

Copy link
Member

@ConnorNeed ConnorNeed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry thought of this after I approved the first time

if (cost == NO_INFORMATION) {
continue;
// When new grid map data has arrived, copy it into the internal buffer
if (has_updated_data_) {
Copy link
Member

@ConnorNeed ConnorNeed Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (has_updated_data_) {
if (has_updated_data_ || layered_costmap_->isRolling()) {

How much does this hurt performance?

When costmap is located at (x1, y1) then translated to the costmap frame and copied over to the intenal layer. Then the next iteration happens and no new message has come in. We don't copy over to the intenal layer since no new map has happened. Internal layer is still based on (x1, y1) even though the robot has moved to (x2, y2). We don't move fast enough to really notice it but if we stop recieving data (very possible if the zed crashes) then the rolling costmap will stay the same even if the rover moves for a long time.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants