Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to YARP-3.5.1 #42

Merged
merged 1 commit into from
Dec 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions iSpeak/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ class MouthHandler : public PeriodicThread
if (emotions.getOutputCount()>0)
{
Bottle cmd, reply;
cmd.addVocab(Vocab::encode("set"));
cmd.addVocab(Vocab::encode("mou"));
cmd.addVocab(Vocab::encode(state));
cmd.addVocab32("set");
cmd.addVocab32("mou");
cmd.addVocab32(state);
emotions.write(cmd,reply);
}
}
Expand Down Expand Up @@ -141,7 +141,7 @@ class MouthHandler : public PeriodicThread
if (r1.getOutputCount()>0)
{
Bottle cmd,rep;
cmd.addVocab(Vocab::encode("tstart"));
cmd.addVocab32("tstart");
r1.write(cmd,rep);
}

Expand Down Expand Up @@ -170,7 +170,7 @@ class MouthHandler : public PeriodicThread
r1.open("/"+name+"/r1:rpc");

state="sur";
setPeriod((double)rf.check("period",Value(200)).asInt()/1000.0);
setPeriod((double)rf.check("period",Value(200)).asInt32()/1000.0);
}

/************************************************************************/
Expand All @@ -185,7 +185,7 @@ class MouthHandler : public PeriodicThread
if (r1.getOutputCount()>0)
{
Bottle cmd,rep;
cmd.addVocab(Vocab::encode("tstart"));
cmd.addVocab32("tstart");
r1.write(cmd,rep);
}

Expand All @@ -208,7 +208,7 @@ class MouthHandler : public PeriodicThread
if (r1.getOutputCount()>0)
{
Bottle cmd,rep;
cmd.addVocab(Vocab::encode("tstop"));
cmd.addVocab32("tstop");
r1.write(cmd,rep);
}
}
Expand Down Expand Up @@ -335,17 +335,17 @@ class iSpeak : protected BufferedPort<Bottle>,
{
if (request.get(0).isString())
phrase=request.get(0).asString();
else if (request.get(0).isDouble() || request.get(0).isInt())
else if (request.get(0).isFloat64() || request.get(0).isInt32())
{
time=request.get(0).asDouble();
time=request.get(0).asFloat64();
onlyMouth=true;
}

if (request.size()>1)
{
if (request.get(1).isInt())
if (request.get(1).isInt32())
{
int newRate=request.get(1).asInt();
int newRate=request.get(1).asInt32();
if (newRate>0)
{
mouth.setPeriod((double)newRate/1000.0);
Expand All @@ -354,8 +354,8 @@ class iSpeak : protected BufferedPort<Bottle>,
}

if ((request.size()>2) && request.get(0).isString())
if (request.get(2).isDouble() || request.get(2).isInt())
duration=request.get(2).asDouble();
if (request.get(2).isFloat64() || request.get(2).isInt32())
duration=request.get(2).asFloat64();
}
}
}
Expand Down Expand Up @@ -474,19 +474,19 @@ class Launcher: public RFModule
/************************************************************************/
bool respond(const Bottle &command, Bottle &reply)
{
int cmd0=command.get(0).asVocab();
if (cmd0==Vocab::encode("stat"))
int cmd0=command.get(0).asVocab32();
if (cmd0==Vocab32::encode("stat"))
{
reply.addString(speaker.isSpeaking()?"speaking":"quiet");
return true;
}

if (command.size()>1)
{
int cmd1=command.get(1).asVocab();
if (cmd1==Vocab::encode("opt"))
int cmd1=command.get(1).asVocab32();
if (cmd1==Vocab32::encode("opt"))
{
if (cmd0==Vocab::encode("set"))
if (cmd0==Vocab32::encode("set"))
{
if (command.size()>2)
{
Expand All @@ -496,7 +496,7 @@ class Launcher: public RFModule
return true;
}
}
else if (cmd0==Vocab::encode("get"))
else if (cmd0==Vocab32::encode("get"))
{
reply.addString(speaker.get_package_options());
return true;
Expand Down
2 changes: 1 addition & 1 deletion speech-interpreters/start/input/src/start-speech.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ void STARTManager::onRead(yarp::os::Bottle &bot)
{
std::string::size_type sz; // alias of size_t
int i_dec = std::stoi (words,&sz);
finalTmp.addInt(i_dec);
finalTmp.addInt32(i_dec);
}
}
answer.erase(answer.find_first_of("["), answer.find_first_of("]"));
Expand Down
2 changes: 1 addition & 1 deletion speechInteraction/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ find_package(ICUBcontrib REQUIRED)
find_package(Protobuf REQUIRED)
find_package(gRPC CONFIG REQUIRED)
find_package(GOOGLEAPIS REQUIRED)
find_package(YARP 3.2.1 REQUIRED COMPONENTS OS sig dev math)
find_package(YARP 3.5.1 REQUIRED COMPONENTS OS sig dev math)

include_directories(${googleapis_INCLUDE_DIR})

Expand Down
4 changes: 2 additions & 2 deletions speechInteraction/modules/googleSpeech/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ class Processing : public yarp::os::TypedReaderCallback<yarp::sig::Sound>
{
std::lock_guard<std::mutex> lg(mtx);
yarp::os::Bottle cmd, rep;
//cmd.addVocab(yarp::os::Vocab::encode("start"));
//cmd.addVocab32("start");
cmd.addString("start");
if (audioCommand.write(cmd, rep))
{
Expand Down Expand Up @@ -405,7 +405,7 @@ class Module : public yarp::os::RFModule, public googleSpeech_IDL

std::string moduleName = rf.check("name", yarp::os::Value("googleSpeech"), "module name (string)").asString();
std::string language = rf.check("language_code", yarp::os::Value("en-US"), "language (string)").asString();
int sample_rate = rf.check("sample_rate_hertz", yarp::os::Value(16000), "sample rate (int)").asInt();
int sample_rate = rf.check("sample_rate_hertz", yarp::os::Value(16000), "sample rate (int)").asInt32();

if (rf.check("uniqueSound", "use a yarp::sig::Sound instead of a microphone"))
uniqueSound = true;
Expand Down
12 changes: 6 additions & 6 deletions speechInteraction/modules/googleSpeechProcess/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,11 +382,11 @@ class Processing : public yarp::os::BufferedPort<yarp::os::Bottle>
yarp::os::Bottle &sentiment_score = sentiment.addList();
sentiment_score.addString("Score");
std::pair<float,float> sentiment_result = read_sentiment( sentiment_sentences );
sentiment_score.addDouble(sentiment_result.second);
sentiment_score.addFloat64(sentiment_result.second);

yarp::os::Bottle &sentiment_magnitude = sentiment.addList();
sentiment_magnitude.addString("Magnitude");
sentiment_magnitude.addDouble(sentiment_result.first);
sentiment_magnitude.addFloat64(sentiment_result.first);

yInfo() << "wordList " << wordList.toString().c_str();

Expand Down Expand Up @@ -618,15 +618,15 @@ class Processing : public yarp::os::BufferedPort<yarp::os::Bottle>
sentiment_analysis.addString(sentence); //add the sentence
yarp::os::Bottle* sentiment = wordList.get(0).asList()->get(element-1).asList();
//yInfo() << "sentiment " << sentiment->toString();//Sentiment (Score 0.100000001490116119385) (Magnitude 0.100000001490116119385)
double score = sentiment->get(1).asList()->get(1).asDouble();
double magnitude = sentiment->get(2).asList()->get(1).asDouble();
double score = sentiment->get(1).asList()->get(1).asFloat64();
double magnitude = sentiment->get(2).asList()->get(1).asFloat64();
//printf("Values: %f %f\n", score, magnitude);
yarp::os::Bottle &each_score = sentiment_analysis.addList();
each_score.addString("Score"); //add the corresponding score
each_score.addDouble(score);
each_score.addFloat64(score);
yarp::os::Bottle &each_magnitude = sentiment_analysis.addList();
each_magnitude.addString("Magnitude"); //add the corresponding magnitude
each_magnitude.addDouble(magnitude);
each_magnitude.addFloat64(magnitude);



Expand Down
4 changes: 2 additions & 2 deletions speechInteraction/modules/googleSynthesis/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,8 @@ class Module : public yarp::os::RFModule, public googleSynthesis_IDL
std::string language = rf.check("language", yarp::os::Value("en-US"), "language to use (string)").asString();
std::string voice = rf.check("voice", yarp::os::Value("en-US-Wavenet-D"), "voice to use (string)").asString();

double speed = rf.check("speed", yarp::os::Value(1.0), "speed to use (double)").asDouble();
double pitch = rf.check("pitch", yarp::os::Value(0.0), "pitch to use (double)").asDouble();
double speed = rf.check("speed", yarp::os::Value(1.0), "speed to use (double)").asFloat64();
double pitch = rf.check("pitch", yarp::os::Value(0.0), "pitch to use (double)").asFloat64();

if (rf.check("languageCodes", "Getting language codes"))
{
Expand Down
20 changes: 10 additions & 10 deletions speechRecognizer/src/SpeechRecognizerModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ std::vector<std::string> split(const std::string &s, char delim) {
bool SpeechRecognizerModule::configure(ResourceFinder &rf )
{
setName( rf.check("name",Value("speechRecognizer")).asString().c_str() );
m_timeout = rf.check("timeout",Value(10000)).asInt();
m_timeout = rf.check("timeout",Value(10000)).asInt32();
USE_LEGACY = !rf.check("noLegacy");
m_forwardSound = rf.check("forwardSound");
m_tmpFileFolder = rf.getHomeContextPath();
Expand Down Expand Up @@ -265,7 +265,7 @@ bool SpeechRecognizerModule::updateModule()
//Send over yarp
Bottle bOut;
bOut.addString(fullSentence);
bOut.addInt(confidence);
bOut.addInt32(confidence);
m_portContinuousRecognition.write(bOut);

//Treat the semantic
Expand Down Expand Up @@ -644,7 +644,7 @@ string SpeechRecognizerModule::getFromDictaction(int timeout, LPCWSTR options )
for(list< pair<string, double> >::iterator it = results.begin(); it != results.end(); it++)
{
botTmp.addString(it->first);
//botTmp.addDouble(it->second);
//botTmp.addFloat64(it->second);
}
}
yInfo() <<"Dictation is off...";
Expand All @@ -662,8 +662,8 @@ bool SpeechRecognizerModule::handleRecognitionCmd(const Bottle& cmd, Bottle& rep

if (firstVocab == "timeout")
{
m_timeout = cmd.get(1).asInt();
//reply.addInt(true);
m_timeout = cmd.get(1).asInt32();
//reply.addInt32(true);
return false;
}

Expand All @@ -684,7 +684,7 @@ bool SpeechRecognizerModule::handleRecognitionCmd(const Bottle& cmd, Bottle& rep
for(list< pair<string, double> >::iterator it = results.begin(); it != results.end(); it++)
{
reply.addString(it->first);
reply.addDouble(it->second);
reply.addFloat64(it->second);
}
else
reply.addString("-1");
Expand All @@ -694,7 +694,7 @@ bool SpeechRecognizerModule::handleRecognitionCmd(const Bottle& cmd, Bottle& rep
//Turn off dictation and go back to the file grammar
everythingIsFine &= SUCCEEDED(m_cpGrammarDictation->SetDictationState( SPRS_INACTIVE ));
everythingIsFine &=SUCCEEDED(m_cpGrammarFromFile->SetGrammarState(SPGS_ENABLED));
//reply.addInt(true);
//reply.addInt32(true);
return true;
}
// If we are not in dictation then we set and switch to the runtimeGrammar
Expand All @@ -716,7 +716,7 @@ bool SpeechRecognizerModule::handleRecognitionCmd(const Bottle& cmd, Bottle& rep

refreshFromVocabulories(m_cpGrammarRuntime);

//reply.addInt(everythingIsFine);
//reply.addInt32(everythingIsFine);
}

else if (firstVocab == "choices")
Expand Down Expand Up @@ -758,7 +758,7 @@ bool SpeechRecognizerModule::handleRecognitionCmd(const Bottle& cmd, Bottle& rep
for(list< pair<string, double> >::iterator it = results.begin(); it != results.end(); it++)
{
reply.addString(it->first);
reply.addDouble(it->second);
reply.addFloat64(it->second);
}
else
reply.addString("-1");
Expand Down Expand Up @@ -882,7 +882,7 @@ void SpeechRecognizerModule::say(string s, bool wait)
if(wait)
{
yarp::os::Bottle cmd,reply;
cmd.addVocab(VOCAB('s','t','a','t'));
cmd.addVocab32(VOCAB('s','t','a','t'));
std::string status = "speaking";
bool speechStarted = false;
while(wait&&(!speechStarted ||status=="speaking"))
Expand Down
4 changes: 2 additions & 2 deletions svox-speech/speech.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ bool Speech::open(yarp::os::Searchable &config)
return false;
}

setPitch(config.check("pitch",Value(90)).asInt());
setSpeed(config.check("speed",Value(105)).asInt());
setPitch(config.check("pitch",Value(90)).asInt32());
setSpeed(config.check("speed",Value(105)).asInt32());

lingwareRF.setDefaultContext(config.check("lingware-context",Value("speech")).asString());
lingwareRF.configure(0,NULL);
Expand Down