Skip to content
Snippets Groups Projects
Commit 6345748c authored by Sergi Hernandez's avatar Sergi Hernandez
Browse files

Implemented the API functions of the TTS module.

parent f35bb707
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment