March 2018
Intermediate to advanced
1396 pages
42h 14m
English
The speech recognition node subscribes to /recognizer/output and publishes to the /chatter topic:
#!/usr/bin/env python
import rospy
from std_msgs.msg import String
rospy.init_node('aiml_speech_recog_client')
pub = rospy.Publisher('chatter', String,queue_size=10)
r = rospy.Rate(1) # 10hz
def get_speech(data):
speech_text=data.data
rospy.loginfo("I said:: %s",speech_text)
pub.publish(speech_text)
def listener():
rospy.loginfo("Starting Speech Recognition")
rospy.Subscriber("/recognizer/output", String, get_speech)
rospy.spin()
while not rospy.is_shutdown():
listener()
The /recognizer/output topic is published by ROS speech recognition packages such as Pocket Sphinx (http://wiki.ros.org/pocketsphinx).
Next, ...