diff --git a/Robot/UR/URModbusServer.py b/Robot/UR/URModbusServer.py index 5464daf..e270b70 100644 --- a/Robot/UR/URModbusServer.py +++ b/Robot/UR/URModbusServer.py @@ -58,9 +58,9 @@ class URModbusServer: Connects with the Modbus server to requests the angles of each joint, in radians :return: Readable angle values of each joint in radials """ - if tries>10: - print("[Angles] Modbus Error: Failed") - return 0, 0, 0, 0, 0, 0 + if tries>50: + raise Exception("[Angles] Modbus Error: Failed") + #return 0, 0, 0, 0, 0, 0 packet = self.modbusTCP.read_holding_registers(270, quantity=6) time.sleep(0.001) @@ -89,9 +89,9 @@ class URModbusServer: Connects with the Modbus server to requests the speed of each joint, in radians per second :return: Readable angle speeds of each joint in radians per second """ - if tries>10: + if tries>50: print("[Speeds] Modbus Error: Failed") - return 0, 0, 0, 0, 0, 0 + #raise Exception("[Speeds] Modbus Error: Failed") packet = self.modbusTCP.read_holding_registers(280, quantity=6) diff --git a/URSentry.py b/URSentry.py index a91cf31..4b756e3 100644 --- a/URSentry.py +++ b/URSentry.py @@ -17,7 +17,7 @@ class URSentry: # Flags self.ESTOP = False - self.await_stop = False + self.await_stop = True self.await_stop_ticks = 0 self.send_to_zero_on_stop = False @@ -35,6 +35,7 @@ class URSentry: self.await_stop = True self.sentry_position() self.has_initialized = True + self.is_on_sentry_mode = True def get_joint_angles(self) -> "list[float]": """ diff --git a/UnifiWebsockets/Unifi.py b/UnifiWebsockets/Unifi.py index f62e5f3..3fb600a 100644 --- a/UnifiWebsockets/Unifi.py +++ b/UnifiWebsockets/Unifi.py @@ -68,7 +68,10 @@ def find_coords(message: str) -> list[str]: def run(q: queue.Queue, passwrd : str | None = None) -> None: base_url = "https://172.22.114.176" # Replace with your UniFi Protect base URL username = "engr-ugaif" # Replace with your username - password = dotenv.get_key(dotenv.find_dotenv(), "UNIFI_PASSWORD") if passwrd is None else passwrd + if passwrd is None: + password = dotenv.get_key(dotenv.find_dotenv(), "UNIFI_PASSWORD") + else: + password = passwrd ws_url = "wss://172.22.114.176/proxy/protect/ws/liveDetectTrack?camera=668daa1e019ce603e4002d31" # Replace with your WebSocket URL cookies = get_token(base_url, username, password) diff --git a/dockerfile b/dockerfile index 639267c..43b19e8 100644 --- a/dockerfile +++ b/dockerfile @@ -17,6 +17,6 @@ COPY BBoxProcessor.py . COPY URSentry.py . COPY dockermain.py . -ENV UNIFI_PASSWORD = '' +ENV UNIFI_PASSWORD='' CMD [ "python", "./dockermain.py" ] \ No newline at end of file