feat: face recognition agent #53

Open
2584433 wants to merge 31 commits from feat/face-recognition into main
Showing only changes of commit f41201dd8e - Show all commits

View File

@@ -38,7 +38,7 @@ class RICommunicationAgent(BaseAgent):
def __init__(
self,
name: str,
address=settings.zmq_settings.ri_communication_address,
address=settings.zmq_settings.ri_command_address,
bind=False,
):
super().__init__(name)
@@ -168,7 +168,7 @@ class RICommunicationAgent(BaseAgent):
bind = port_data["bind"]
if not bind:
addr = f"tcp://{settings.ri_host}:{port}"
addr = f"tcp://localhost:{port}"
else:
addr = f"tcp://*:{port}"
@@ -268,30 +268,6 @@ class RICommunicationAgent(BaseAgent):
if self.pub_socket is not None:
await self.pub_socket.send_multipart([topic, data])
await asyncio.sleep(settings.behaviour_settings.sleep_s)
case "face":
# Ask the RI for current face status
request = {"endpoint": "face", "data": {}}
try:
assert self._req_socket is not None
await self._req_socket.send_json(request)
response = await asyncio.wait_for(
self._req_socket.recv_json(), timeout=2.0
)
# Expect response: {"endpoint": "face", "data": True/False}
face_status = response.get("data", False)
topic = b"face"
data = json.dumps(face_status).encode()
if self.pub_socket is not None:
await self.pub_socket.send_multipart([topic, data])
self.logger.debug(f"Face status: {face_status}")
except Exception as e:
self.logger.warning(f"Failed to get face status: {e}")
case _:
self.logger.debug(
"Received message with topic different than ping, while ping expected."