Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable entity-specific calculation of inspected points + inspected points score #28

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -500,9 +500,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 @@ -547,7 +555,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
Loading