Skip to content

Commit b8e294d

Browse files
Juliana MashonJuliana Mashon
Juliana Mashon
authored and
Juliana Mashon
committed
Fixed check_position()
1 parent 40e760c commit b8e294d

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

broker_functions.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -309,21 +309,19 @@ def get_xyz(self):
309309
return x_val, y_val, z_val
310310

311311
def check_position(self, user_x, user_y, user_z, tolerance):
312-
# Check current xyz coord = user xyz coord within tolerance
313-
# Return in or out of tolerance range
314312
user_values = [user_x, user_y, user_z]
315313

316314
position = self.get_xyz()
317315
actual_vals = list(position)
318316

319317
for user_value, actual_value in zip(user_values, actual_vals):
320-
if actual_value - tolerance <= user_value <= actual_value + tolerance:
321-
print(f"Farmbot is at position {position}")
322-
return True
323-
else:
318+
if not actual_value - tolerance <= user_value <= actual_value + tolerance:
324319
print(f"Farmbot is NOT at position {position}")
325320
return False
326321

322+
print(f"Farmbot is at position {position}")
323+
return True
324+
327325
def control_peripheral(self, id, value, mode=None):
328326
# Change peripheral values
329327
# No inherent return value

0 commit comments

Comments
 (0)