Exemplo n.º 1
0
import rospy
from actionlib import SimpleActionClient
from cerevoice_tts_msgs.msg import TtsAction, TtsGoal, TtsFeedback

if __name__ == '__main__':
    rospy.init_node('test_sentences')

    rospy.loginfo("Waiting for /tts action server...")
    tts_ac = SimpleActionClient('/tts', TtsAction)
    tts_ac.wait_for_server()

    def feedback_callback(feedback_msg):
        rospy.loginfo("Got feedback: " + str(feedback_msg))

    tts_ac.feedback_cb = feedback_callback
    rospy.loginfo("Connected!")

    g = TtsGoal()

    # Sentences from the examples of the SDK PDF

    s1 = "Testing <mark name='MyEasyToRecognizeMarker'/>1 2 3"
    g.text = s1

    rospy.loginfo("Saying: " + str(s1))
    tts_ac.send_goal_and_wait(g)

    s2 = "Today, <voice emotion='happy'>the sun is shining.</voice>"
    g.text = s2