Skip to content

Commit

Permalink
Fix #440, correctly delete old grid
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthijsBurgh committed Sep 28, 2021
1 parent d432ff1 commit d36de81
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/navigation/OccupancyGridClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,13 @@ ROS3D.OccupancyGridClient.prototype.processMessage = function(message){
// check for an old map
if (this.currentGrid) {
// check if it there is a tf client
if (this.currentGrid.tfClient) {
if (this.tfClient) {
// grid is of type ROS3D.SceneNode
this.currentGrid.unsubscribeTf();
this.sceneNode.unsubscribeTf();
this.sceneNode.remove(this.currentGrid);
} else {
this.rootObject.remove(this.currentGrid);
}
this.sceneNode.remove(this.currentGrid);
this.currentGrid.dispose();
}

Expand Down

0 comments on commit d36de81

Please sign in to comment.