Skip to content

Commit

Permalink
fix(inspection): enable entity-specific inspection point attributionf…
Browse files Browse the repository at this point in the history
…ixed agent inspection weight attribution bug and added single agent inspection points attribution (#28)

Co-authored-by: John McCarroll <[email protected]>
  • Loading branch information
JohnMcCarroll and John McCarroll authored Jan 9, 2025
1 parent a17913d commit c3aa3a5
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions safe_autonomy_simulation/sims/inspection/inspection_points.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,9 +519,17 @@ def get_num_points_inspected(self, inspector_entity: e.Entity = None) -> int:
number of points inspected
"""
num_points = 0
for _, point in self.points.items():
if point.inspected:
num_points += 1
if inspector_entity:
# count number of points inspected by the provided entity
for _, point in self.points.items():
if point.inspected and inspector_entity.name in point.inspector:
num_points += 1
else:
# count the total number of points inspected
for _, point in self.points.items():
if point.inspected:
num_points += 1

return num_points

def get_percentage_of_points_inspected(
Expand Down Expand Up @@ -566,7 +574,7 @@ def get_total_weight_inspected(
for _, point in self.points.items():
if inspector_entity:
weight += (
point.weight if point.inspector == inspector_entity.name else 0.0
point.weight if point.inspected and inspector_entity.name in point.inspector else 0.0
)
else:
weight += point.weight if point.inspected else 0.0
Expand Down

0 comments on commit c3aa3a5

Please sign in to comment.