|
|
@@ -50,7 +50,7 @@ def drive_plant_thread(plantID, actionID, client: mqtt.Client): |
|
|
|
Meassure and publish data via MQTT |
|
|
|
Drive home to starting point |
|
|
|
|
|
|
|
***If color codes are working properly this function is not needed anymore*** |
|
|
|
***Function is only neccessary for driving without color codes*** |
|
|
|
|
|
|
|
Args: |
|
|
|
plantID (_type_): plant to measure |
|
|
@@ -116,7 +116,7 @@ def drive_plant_all_thread(plantIDs: list, actionID, client: mqtt.Client): |
|
|
|
client (mqtt.Client): current MQTT client |
|
|
|
""" |
|
|
|
|
|
|
|
allPlantData = { |
|
|
|
allPlantData = { # Sensordata for all plants |
|
|
|
"SensorData": [], |
|
|
|
"ActionID": "" |
|
|
|
} |
|
|
@@ -168,11 +168,12 @@ 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.info(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 |
|
|
|
|
|
|
|
# End of drive and measure operation |
|
|
|
logging.info("All Plants measured, sending data") |
|
|
|
client.publish(Topics["ROBOT_DATA_ALL"], json.dumps(allPlantData, indent=4), qos=1) |
|
|
|
|
|
|
@@ -206,7 +207,7 @@ def drive_plant(client: mqtt.Client, userdata, message: mqtt.MQTTMessage): |
|
|
|
Function to drive to plant according to request |
|
|
|
Starting Drive in Thread to not block main programm |
|
|
|
|
|
|
|
***If color codes are working properly this function is not needed anymore*** |
|
|
|
***Function is only neccessary for driving without color codes*** |
|
|
|
|
|
|
|
Args: |
|
|
|
client (mqtt.Client): current mqtt client |