Skip to content

Commit

Permalink
allow ignore for occupancy calculation
Browse files Browse the repository at this point in the history
Signed-off-by: Reuben Thomas <reubenthomas123@gmail.com>
  • Loading branch information
reuben-thomas committed Jul 31, 2024
1 parent a944432 commit 94ccc5c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions rmf_site_editor/src/occupancy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ pub struct CalculateGrid {
pub floor: f32,
/// Ignore meshes above this height
pub ceiling: f32,
// Ignore these entities
pub ignore: Option<HashSet<Entity>>,
}

enum Group {
Expand Down Expand Up @@ -180,6 +182,14 @@ fn calculate_grid(
let physical_entities = collect_physical_entities(&bodies, &meta);
info!("Checking {:?} physical entities", physical_entities.len());
for e in &physical_entities {
if request
.ignore
.as_ref()
.is_some_and(|ignored_set| ignored_set.contains(e))
{
continue;
}

let (_, mesh, aabb, tf) = match bodies.get(*e) {
Ok(body) => body,
Err(_) => continue,
Expand Down
2 changes: 2 additions & 0 deletions rmf_site_editor/src/widgets/view_occupancy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ impl<'w> ViewOccupancy<'w> {
cell_size: self.display_occupancy.cell_size,
floor: 0.01,
ceiling: 1.5,
ignore: None,
});
}
if ui
Expand All @@ -75,6 +76,7 @@ impl<'w> ViewOccupancy<'w> {
cell_size: self.display_occupancy.cell_size,
floor: 0.01,
ceiling: 1.5,
ignore: None,
});
}
}
Expand Down

0 comments on commit 94ccc5c

Please sign in to comment.