feat: basic implementation of CB2RI

Nothing fancy yet. When we receive a message through ZeroMQ's PUB/SUB
architecture, we tell the robot to say it out loud.
This commit is contained in:
2025-09-27 20:41:03 +02:00
parent 318ad5f88a
commit a41552f7c6

27
main.py Normal file
View File

@@ -0,0 +1,27 @@
import qi
import zmq
import time
def say(session, message):
tts = session.service("ALTextToSpeech")
tts.say(message)
if __name__ == "__main__":
app = qi.Application()
app.start()
session = app.session
context = zmq.Context()
socket = context.socket(zmq.SUB)
socket.connect("tcp://localhost:5556")
socket.setsockopt_string(zmq.SUBSCRIBE, u"") # u because Python 2 shenanigans
while True:
print("Listening for message")
message = socket.recv_string()
print("Received message: {}".format(message))
say(session, message)
time.sleep(1)