fix: use qi session from state in actuation receiver
ref: N25B-168
This commit is contained in:
@@ -3,6 +3,7 @@ import logging
|
|||||||
import zmq
|
import zmq
|
||||||
|
|
||||||
from robot_interface.endpoints.receiver_base import ReceiverBase
|
from robot_interface.endpoints.receiver_base import ReceiverBase
|
||||||
|
from robot_interface.state import state
|
||||||
|
|
||||||
|
|
||||||
class ActuationReceiver(ReceiverBase):
|
class ActuationReceiver(ReceiverBase):
|
||||||
@@ -18,7 +19,7 @@ class ActuationReceiver(ReceiverBase):
|
|||||||
"""
|
"""
|
||||||
super(ActuationReceiver, self).__init__("actuation")
|
super(ActuationReceiver, self).__init__("actuation")
|
||||||
self.create_socket(zmq_context, zmq.SUB, port)
|
self.create_socket(zmq_context, zmq.SUB, port)
|
||||||
self.socket.setsockopt_string(zmq.SUBSCRIBE, u"")
|
self.socket.setsockopt_string(zmq.SUBSCRIBE, u"") # Can this not be given in the options?
|
||||||
self._tts_service = None
|
self._tts_service = None
|
||||||
|
|
||||||
def _handle_speech(self, message):
|
def _handle_speech(self, message):
|
||||||
@@ -29,10 +30,10 @@ class ActuationReceiver(ReceiverBase):
|
|||||||
|
|
||||||
logging.debug("Received message to speak: {}".format(text))
|
logging.debug("Received message to speak: {}".format(text))
|
||||||
|
|
||||||
if not self._qi_session: return
|
if not state.qi_session: return
|
||||||
|
|
||||||
if not self._tts_service:
|
if not self._tts_service:
|
||||||
self._tts_service = self._qi_session.service("ALTextToSpeech")
|
self._tts_service = state.qi_session.service("ALTextToSpeech")
|
||||||
|
|
||||||
self._tts_service.say(text)
|
self._tts_service.say(text)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user