Skip to content

Commit

Permalink
feat: safety check min nav threshold now works
Browse files Browse the repository at this point in the history
  • Loading branch information
ntamas committed Apr 22, 2024
1 parent 644436a commit 063963a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/modules/sbstudio/plugin/model/safety_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,10 +314,13 @@ def should_show_proximity_warning(self) -> bool:
"""Returns whether the proximity warning should be drawn in the 3D view
_right now_, given the current values of the properties.
"""
# self.min_distance has to be extended a bit (by about 1cm) because of
# numerical inaccuracies that yield false warnings during takeoff when
# the grid spacing is equal to the safety distance
return (
self.proximity_warning_enabled
and self.min_distance_is_valid
and self.min_distance < self.proximity_warning_threshold
and self.min_distance + 1e-2 < self.proximity_warning_threshold
)

@property
Expand Down
2 changes: 1 addition & 1 deletion src/modules/sbstudio/plugin/tasks/safety_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def run_safety_check(scene: Scene, depsgraph) -> None:
[
pos
for name, vel in velocity_snapshot.items()
if (vel[0] != 0 or vel[1] != 0)
if hypot(vel[0], vel[1]) > 1e-2
and (pos := snapshot.get(name, _ZERO))[2] < min_altitude
]
if min_altitude is not None and min_altitude_found < min_altitude
Expand Down

0 comments on commit 063963a

Please sign in to comment.