Skip to content

Commit

Permalink
Merge pull request #328 from mqcmd196/PR/fix_dialogflow_text_sub
Browse files Browse the repository at this point in the history
[dialogflow_task_executive] Fix bugs when subscribing /text (std_msgs/String) topic
  • Loading branch information
k-okada authored Jan 31, 2022
2 parents 712cf10 + 7d13c3b commit 4a37c34
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion dialogflow_task_executive/node_scripts/dialogflow_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,20 @@ def hotword_cb(self, msg):
rospy.loginfo("Hotword received")
self.state.set(State.LISTENING)

def text_cb(self, msg):
self.queue.put(msg)
rospy.loginfo("Recieved input")

def input_cb(self, msg):
if not self.enable_hotword:
self.state.set(State.LISTENING)
elif not self.use_audio:
# catch hotword from string
if isinstance(msg, SpeechRecognitionCandidates):
self.hotword_cb(String(data=msg.transcript[0]))
# if std_msgs/String was subscribed
elif isinstance(msg, String):
self.hotword_cb(data)
self.text_cb(msg)
else:
rospy.logerr("Unsupported data class {}".format(msg))

Expand Down

0 comments on commit 4a37c34

Please sign in to comment.