node_main.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 # -*- coding: utf-8 -*-
00003 """
00004 Copyright (c) 2016 Xu Zhihao (Howe).  All rights reserved.
00005 This program is free software; you can redistribute it and/or modify
00006 This programm is tested on kuboki base turtlebot."""
00007 
00008 import rospy
00009 from std_msgs.msg import String
00010 
00011 class recoder_main():
00012  def __init__(self):
00013   self.define()
00014   rospy.Subscriber(self.topic , String , self.talker)
00015   rospy.spin()
00016    
00017  def define(self):
00018   self.say=rospy.Publisher('speak_string', String, queue_size=1)
00019   if not rospy.has_param('~words'):
00020    rospy.set_param('~words','请让一下,谢谢')
00021    
00022   if not rospy.has_param('~SpeakerSubTopic'):
00023    rospy.set_param('~SpeakerSubTopic', 'stop_flag')
00024    
00025   self.words=rospy.get_param('~words')
00026   self.topic=rospy.get_param('~SpeakerSubTopic')
00027   
00028  def talker(self,data):
00029   if data.data=='stop':
00030    self.say.publish(self.words)
00031   else:
00032    pass
00033    
00034 if __name__=="__main__":
00035  rospy.init_node('warning2speaker')
00036  rospy.loginfo("initialization system")
00037  recoder_main()
00038  rospy.loginfo("process done and quit")


simple_voice
Author(s): zhihao
autogenerated on Fri Nov 11 2016 03:44:53