Skip to content
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: 11 additions & 5 deletions py-scripts/lf_base_robo.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ def wait_for_battery(self, stop=None, monitor_function=None):
# charge_dock_move_start_timestamp = ""
charge_dock_arrival_timestamp = ""
charging_completion_timestamp = ""
battery_retries = 0
while True:
try:
response = requests.get(battery_url, timeout=5)
Expand Down Expand Up @@ -196,11 +197,16 @@ def wait_for_battery(self, stop=None, monitor_function=None):
return pause, stopped

except Exception as e:
logging.info("[ERROR] Failed to check battery: {}".format(e))
stopped = True
if monitor_function:
return pause, stopped, {}
return pause, stopped
battery_retries += 1
logging.info("[ERROR] Failed to check battery: {}. Retry {}/15".format(e, battery_retries))

if battery_retries >= 15:
stopped = True
if monitor_function:
return pause, stopped, {}
return pause, stopped

time.sleep(4)

def move_to_coordinate(self, coord, monitor_function=None):
"""
Expand Down
Loading