diff --git a/include/tiago_modules/tts_module.h b/include/tiago_modules/tts_module.h index b7dddd145f6a49e0fc610636b326ea93c4a21dca..78a4745c09331355e803e87f3e2735fb409e2fc4 100644 --- a/include/tiago_modules/tts_module.h +++ b/include/tiago_modules/tts_module.h @@ -29,7 +29,8 @@ class CTTSModule : public CModule<tts_module::TTSModuleConfig> tts_module::TTSModuleConfig config; CModuleAction<pal_interaction_msgs::TtsAction> tts_action; - pal_interaction_msgs::TtsGoal goal; + pal_interaction_msgs::TtsGoal speech_goal; + std::string speaker; //Variables tts_module_state_t state; @@ -44,9 +45,8 @@ class CTTSModule : public CModule<tts_module::TTSModuleConfig> public: //CTTSModule(const std::string &name); CTTSModule(const std::string &name,const std::string &name_space=std::string("")); - void set_language(std::string &language); void set_speaker(std::string &speaker); - void say(std::string &text,double delay=0.0); + void say(const std::string &text,const std::string &language=std::string("en_GB"),double delay=0.0); void stop(void); bool is_finished(void); tts_module_status_t get_status(void); diff --git a/src/tts_module.cpp b/src/tts_module.cpp index f3b050ddd9d90f0903cfc77db478a319a85d6a15..def71677441d284fd97df2c4d0cbc7665691d762 100644 --- a/src/tts_module.cpp +++ b/src/tts_module.cpp @@ -30,7 +30,7 @@ void CTTSModule::state_machine(void) break; case TTS_MODULE_START: ROS_DEBUG("CTTSModule: Start"); - switch(this->tts_action.make_request(this->goal)) + switch(this->tts_action.make_request(this->speech_goal)) { case ACT_SRV_SUCCESS: this->state=TTS_MODULE_WAIT; ROS_DEBUG("CTTSModule : goal start successfull"); @@ -110,19 +110,22 @@ void CTTSModule::reconfigure_callback(tts_module::TTSModuleConfig &config, uint3 this->unlock(); } -void CTTSModule::set_language(std::string &language) -{ - -} - void CTTSModule::set_speaker(std::string &speaker) { - + this->lock(); + this->speaker=speaker; + this->unlock(); } -void CTTSModule::say(std::string &text,double delay) +void CTTSModule::say(const std::string &text,const std::string &language,double delay) { - + this->lock(); + this->speech_goal.rawtext.text=text; + this->speech_goal.rawtext.lang_id=language; + this->speech_goal.wait_before_speaking=delay; + this->speech_goal.speakerName=this->speaker; + this->new_speech=true; + this->unlock(); } void CTTSModule::stop(void)