|
|
@@ -68,10 +68,19 @@ def drive_plant_thread(plantID, actionID, client: mqtt.Client): |
|
|
|
return |
|
|
|
|
|
|
|
logging.info("Robot home") |
|
|
|
client.publish(Topics["ROBOT_DATA_ROBOTREADY"], "True", qos=1) |
|
|
|
|
|
|
|
|
|
|
|
# TODO thread all plants |
|
|
|
def drive_plant_all(plantID, actionID, client: mqtt.Client): |
|
|
|
|
|
|
|
# TODO loop through plantID array |
|
|
|
|
|
|
|
logging.info("Robot home") |
|
|
|
client.publish(Topics["ROBOT_DATA_ROBOTREADY"], "True", qos=1) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region MQTT callbacks |
|
|
|
|
|
|
|
def drive_plant(client: mqtt.Client, userdata, message: mqtt.MQTTMessage): |
|
|
@@ -96,6 +105,21 @@ def drive_plant(client: mqtt.Client, userdata, message: mqtt.MQTTMessage): |
|
|
|
thread.start() |
|
|
|
|
|
|
|
|
|
|
|
# TODO Drive all Plants |
|
|
|
# TODO plantID array |
|
|
|
# TODO only possible with color codes |
|
|
|
def drive_plant_all(client: mqtt.Client, userdata, message: mqtt.MQTTMessage): |
|
|
|
dictMessage = json.loads(str(message.payload.decode("UTF-8"))) |
|
|
|
|
|
|
|
plantID = dictMessage["PlantID"] |
|
|
|
actionID = dictMessage["ActionID"] |
|
|
|
|
|
|
|
logging.info(f"Received Drive-request to plants {plantID}, ActionID: {actionID}") |
|
|
|
client.publish(Topics["ROBOT_DATA_ROBOTREADY"], "False", qos=1) |
|
|
|
|
|
|
|
thread = threading.Thread(target= drive_plant_all, args=(plantID, actionID, client), daemon=True) |
|
|
|
thread.start() |
|
|
|
|
|
|
|
def get_position(clients: mqtt.Client, userdata, message: mqtt.MQTTMessage): |
|
|
|
""" |
|
|
|
Callback function for GPS position request |