|
|
@@ -68,7 +68,7 @@ def drive_plant_thread(plantID, actionID, client: mqtt.Client): |
|
|
|
else: |
|
|
|
errorMessage = "Motor or Sensor unplugged" |
|
|
|
|
|
|
|
logging.info(f"{errorMessage}, Drive Plant aborted, Robot at starting position") |
|
|
|
logging.error(f"{errorMessage}, Drive Plant aborted, Robot at starting position") |
|
|
|
client.publish(Topics["ROBOT_DATA_ERROR"], f"{errorMessage}, Drive Plant aborted, Robot at starting position", qos=1) |
|
|
|
client.publish(Topics["ROBOT_DATA_ROBOTREADY"], "True", qos=1) |
|
|
|
return |
|
|
@@ -91,7 +91,7 @@ def drive_plant_thread(plantID, actionID, client: mqtt.Client): |
|
|
|
else: |
|
|
|
errorMessage = "Motor or Sensor unplugged" |
|
|
|
|
|
|
|
logging.info(f"{errorMessage}, Drive Plant aborted, Robot at starting position") |
|
|
|
logging.error(f"{errorMessage}, Drive Plant aborted, Robot at starting position") |
|
|
|
client.publish(Topics["ROBOT_DATA_ERROR"], f"{errorMessage}, Drive Plant aborted, Robot at plant {plantID}", qos=1) |
|
|
|
client.publish(Topics["ROBOT_DATA_ROBOTREADY"], "True", qos=1) |
|
|
|
return |
|
|
@@ -135,7 +135,7 @@ def drive_plant_all_thread(plantIDs: list, actionID, client: mqtt.Client): |
|
|
|
else: |
|
|
|
errorMessage = "Motor or Sensor unplugged" |
|
|
|
|
|
|
|
logging.info(f"{errorMessage}, Drive Plant aborted, Robot at starting position") |
|
|
|
logging.error(f"{errorMessage}, Drive Plant aborted, Robot at starting position") |
|
|
|
client.publish(Topics["ROBOT_DATA_ERROR"], f"{errorMessage}, Drive Plant aborted, Robot at starting position", qos=1) |
|
|
|
client.publish(Topics["ROBOT_DATA_ROBOTREADY"], "True", qos=1) |
|
|
|
return |
|
|
@@ -168,7 +168,7 @@ def drive_plant_all_thread(plantIDs: list, actionID, client: mqtt.Client): |
|
|
|
else: |
|
|
|
errorMessage = "Motor or Sensor unplugged" |
|
|
|
|
|
|
|
logging.info(f"{errorMessage}, Drive Plant aborted, Robot at plant {plant}") |
|
|
|
logging.error(f"{errorMessage}, Drive Plant aborted, Robot at plant {plant}") |
|
|
|
client.publish(Topics["ROBOT_DATA_ERROR"], f"{errorMessage}, Drive Plant aborted, Robot at plant {plant}", qos=1) |
|
|
|
client.publish(Topics["ROBOT_DATA_ROBOTREADY"], "True", qos=1) |
|
|
|
return |
|
|
@@ -188,7 +188,7 @@ def drive_plant_all_thread(plantIDs: list, actionID, client: mqtt.Client): |
|
|
|
else: |
|
|
|
errorMessage = "Motor or Sensor unplugged" |
|
|
|
|
|
|
|
logging.info(f"{errorMessage}, Drive Plant aborted, Robot at starting position") |
|
|
|
logging.error(f"{errorMessage}, Drive Plant aborted, Robot at starting position") |
|
|
|
client.publish(Topics["ROBOT_DATA_ERROR"], f"{errorMessage}, Drive Plant aborted, Robot at plant {plant}", qos=1) |
|
|
|
client.publish(Topics["ROBOT_DATA_ROBOTREADY"], "True", qos=1) |
|
|
|
return |
|
|
@@ -292,7 +292,7 @@ def get_batteryStatus(client: mqtt.Client, userdata, message: mqtt.MQTTMessage): |
|
|
|
batteryLevel = int(os.popen('sshpass -p maker ssh robot@ev3dev.local cat /sys/devices/platform/battery/power_supply/lego-ev3-battery/voltage_now').read()) |
|
|
|
except: |
|
|
|
logging.error("EV3 not connected") |
|
|
|
client.publish(Topics["ROBOT_DATA_ERROR"], "Robot not connected", qos=1) |
|
|
|
client.publish(Topics["ROBOT_DATA_ERROR"], "EV3 not connected", qos=1) |
|
|
|
return |
|
|
|
|
|
|
|
batteryLevel = round(batteryLevel / 1000000, 2) # Conversion to Volt |