Skip to content

Commit 14c73e1

Browse files
committed
Make distance inf, -inf and nan to -1
1 parent 72e11c7 commit 14c73e1

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

mirte_robot/robot.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -500,11 +500,8 @@ def getDistance(self, sensor: str) -> float:
500500

501501
distance: float = range.range
502502

503-
# FIXME: What to do about nan?
504-
if distance == math.inf:
505-
distance = range.max_range
506-
elif distance == -math.inf:
507-
distance = range.min_range
503+
if distance == math.inf or distance == -math.inf or math.isnan(distance):
504+
distance = -1
508505

509506
return distance
510507

0 commit comments

Comments
 (0)