Raspy comment update, Robot UML update

This commit is contained in:
waldluis 2023-08-17 10:37:00 +02:00
parent 22bcf7310f
commit 1778a211bb
4 changed files with 333 additions and 288 deletions

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -50,7 +50,7 @@ def drive_plant_thread(plantID, actionID, client: mqtt.Client):
Meassure and publish data via MQTT Meassure and publish data via MQTT
Drive home to starting point 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: Args:
plantID (_type_): plant to measure 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 client (mqtt.Client): current MQTT client
""" """
allPlantData = { allPlantData = { # Sensordata for all plants
"SensorData": [], "SensorData": [],
"ActionID": "" "ActionID": ""
} }
@ -168,11 +168,12 @@ def drive_plant_all_thread(plantIDs: list, actionID, client: mqtt.Client):
else: else:
errorMessage = "Motor or Sensor unplugged" 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_ERROR"], f"{errorMessage}, Drive Plant aborted, Robot at plant {plant}", qos=1)
client.publish(Topics["ROBOT_DATA_ROBOTREADY"], "True", qos=1) client.publish(Topics["ROBOT_DATA_ROBOTREADY"], "True", qos=1)
return return
# End of drive and measure operation
logging.info("All Plants measured, sending data") logging.info("All Plants measured, sending data")
client.publish(Topics["ROBOT_DATA_ALL"], json.dumps(allPlantData, indent=4), qos=1) 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 Function to drive to plant according to request
Starting Drive in Thread to not block main programm 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: Args:
client (mqtt.Client): current mqtt client client (mqtt.Client): current mqtt client

View File

@ -42,7 +42,7 @@ def readDHT22():
def readTSL2561(): def readTSL2561():
""" """
Reads TSL2561 brightness in Lux and returns integer value Reads TSL2561 brightness via I2C in Lux and returns integer value
Raises: Raises:
Exception: If TSL2561 not connected properly Exception: If TSL2561 not connected properly
@ -67,7 +67,7 @@ def readTSL2561():
def readMCP3008(): def readMCP3008():
""" """
Reads YL-69 via MCP3008 ADC soil moisture in percent and returns float value Reads YL-69 via MCP3008 ADC and SPI soil moisture in percent and returns float value
Raises: Raises:
Exception: If YL-69 not connected properly Exception: If YL-69 not connected properly
@ -133,7 +133,7 @@ def readSensors(sensorData):
sensorData["SoilMoisture"] = 0 # No value returend if error occurs -> setting safe value sensorData["SoilMoisture"] = 0 # No value returend if error occurs -> setting safe value
errorMessage = errorMessage + str(e) + "\n" # Appending received error message to later forward all occured errors errorMessage = errorMessage + str(e) + "\n" # Appending received error message to later forward all occured errors
# raise combined error message # raise combined error message, successfull values still available
if errorMessage != "": if errorMessage != "":
raise Exception(errorMessage) raise Exception(errorMessage)