Skip to content

Commit 3fb83bc

Browse files
pattaciniNicogene
authored andcommitted
upgrade to yarp-3.5.1
1 parent dda4bf4 commit 3fb83bc

File tree

8 files changed

+43
-43
lines changed

8 files changed

+43
-43
lines changed

iSpeak/main.cpp

+19-19
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ class MouthHandler : public PeriodicThread
109109
if (emotions.getOutputCount()>0)
110110
{
111111
Bottle cmd, reply;
112-
cmd.addVocab(Vocab::encode("set"));
113-
cmd.addVocab(Vocab::encode("mou"));
114-
cmd.addVocab(Vocab::encode(state));
112+
cmd.addVocab32("set");
113+
cmd.addVocab32("mou");
114+
cmd.addVocab32(state);
115115
emotions.write(cmd,reply);
116116
}
117117
}
@@ -141,7 +141,7 @@ class MouthHandler : public PeriodicThread
141141
if (r1.getOutputCount()>0)
142142
{
143143
Bottle cmd,rep;
144-
cmd.addVocab(Vocab::encode("tstart"));
144+
cmd.addVocab32("tstart");
145145
r1.write(cmd,rep);
146146
}
147147

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

172172
state="sur";
173-
setPeriod((double)rf.check("period",Value(200)).asInt()/1000.0);
173+
setPeriod((double)rf.check("period",Value(200)).asInt32()/1000.0);
174174
}
175175

176176
/************************************************************************/
@@ -185,7 +185,7 @@ class MouthHandler : public PeriodicThread
185185
if (r1.getOutputCount()>0)
186186
{
187187
Bottle cmd,rep;
188-
cmd.addVocab(Vocab::encode("tstart"));
188+
cmd.addVocab32("tstart");
189189
r1.write(cmd,rep);
190190
}
191191

@@ -208,7 +208,7 @@ class MouthHandler : public PeriodicThread
208208
if (r1.getOutputCount()>0)
209209
{
210210
Bottle cmd,rep;
211-
cmd.addVocab(Vocab::encode("tstop"));
211+
cmd.addVocab32("tstop");
212212
r1.write(cmd,rep);
213213
}
214214
}
@@ -335,17 +335,17 @@ class iSpeak : protected BufferedPort<Bottle>,
335335
{
336336
if (request.get(0).isString())
337337
phrase=request.get(0).asString();
338-
else if (request.get(0).isDouble() || request.get(0).isInt())
338+
else if (request.get(0).isFloat64() || request.get(0).isInt32())
339339
{
340-
time=request.get(0).asDouble();
340+
time=request.get(0).asFloat64();
341341
onlyMouth=true;
342342
}
343343

344344
if (request.size()>1)
345345
{
346-
if (request.get(1).isInt())
346+
if (request.get(1).isInt32())
347347
{
348-
int newRate=request.get(1).asInt();
348+
int newRate=request.get(1).asInt32();
349349
if (newRate>0)
350350
{
351351
mouth.setPeriod((double)newRate/1000.0);
@@ -354,8 +354,8 @@ class iSpeak : protected BufferedPort<Bottle>,
354354
}
355355

356356
if ((request.size()>2) && request.get(0).isString())
357-
if (request.get(2).isDouble() || request.get(2).isInt())
358-
duration=request.get(2).asDouble();
357+
if (request.get(2).isFloat64() || request.get(2).isInt32())
358+
duration=request.get(2).asFloat64();
359359
}
360360
}
361361
}
@@ -474,19 +474,19 @@ class Launcher: public RFModule
474474
/************************************************************************/
475475
bool respond(const Bottle &command, Bottle &reply)
476476
{
477-
int cmd0=command.get(0).asVocab();
478-
if (cmd0==Vocab::encode("stat"))
477+
int cmd0=command.get(0).asVocab32();
478+
if (cmd0==Vocab32::encode("stat"))
479479
{
480480
reply.addString(speaker.isSpeaking()?"speaking":"quiet");
481481
return true;
482482
}
483483

484484
if (command.size()>1)
485485
{
486-
int cmd1=command.get(1).asVocab();
487-
if (cmd1==Vocab::encode("opt"))
486+
int cmd1=command.get(1).asVocab32();
487+
if (cmd1==Vocab32::encode("opt"))
488488
{
489-
if (cmd0==Vocab::encode("set"))
489+
if (cmd0==Vocab32::encode("set"))
490490
{
491491
if (command.size()>2)
492492
{
@@ -496,7 +496,7 @@ class Launcher: public RFModule
496496
return true;
497497
}
498498
}
499-
else if (cmd0==Vocab::encode("get"))
499+
else if (cmd0==Vocab32::encode("get"))
500500
{
501501
reply.addString(speaker.get_package_options());
502502
return true;

speech-interpreters/start/input/src/start-speech.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ void STARTManager::onRead(yarp::os::Bottle &bot)
238238
{
239239
std::string::size_type sz; // alias of size_t
240240
int i_dec = std::stoi (words,&sz);
241-
finalTmp.addInt(i_dec);
241+
finalTmp.addInt32(i_dec);
242242
}
243243
}
244244
answer.erase(answer.find_first_of("["), answer.find_first_of("]"));

speechInteraction/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ find_package(ICUBcontrib REQUIRED)
2020
find_package(Protobuf REQUIRED)
2121
find_package(gRPC CONFIG REQUIRED)
2222
find_package(GOOGLEAPIS REQUIRED)
23-
find_package(YARP 3.2.1 REQUIRED COMPONENTS OS sig dev math)
23+
find_package(YARP 3.5.1 REQUIRED COMPONENTS OS sig dev math)
2424

2525
include_directories(${googleapis_INCLUDE_DIR})
2626

speechInteraction/modules/googleSpeech/main.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ class Processing : public yarp::os::TypedReaderCallback<yarp::sig::Sound>
332332
{
333333
std::lock_guard<std::mutex> lg(mtx);
334334
yarp::os::Bottle cmd, rep;
335-
//cmd.addVocab(yarp::os::Vocab::encode("start"));
335+
//cmd.addVocab32("start");
336336
cmd.addString("start");
337337
if (audioCommand.write(cmd, rep))
338338
{
@@ -405,7 +405,7 @@ class Module : public yarp::os::RFModule, public googleSpeech_IDL
405405

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

410410
if (rf.check("uniqueSound", "use a yarp::sig::Sound instead of a microphone"))
411411
uniqueSound = true;

speechInteraction/modules/googleSpeechProcess/main.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -382,11 +382,11 @@ class Processing : public yarp::os::BufferedPort<yarp::os::Bottle>
382382
yarp::os::Bottle &sentiment_score = sentiment.addList();
383383
sentiment_score.addString("Score");
384384
std::pair<float,float> sentiment_result = read_sentiment( sentiment_sentences );
385-
sentiment_score.addDouble(sentiment_result.second);
385+
sentiment_score.addFloat64(sentiment_result.second);
386386

387387
yarp::os::Bottle &sentiment_magnitude = sentiment.addList();
388388
sentiment_magnitude.addString("Magnitude");
389-
sentiment_magnitude.addDouble(sentiment_result.first);
389+
sentiment_magnitude.addFloat64(sentiment_result.first);
390390

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

@@ -618,15 +618,15 @@ class Processing : public yarp::os::BufferedPort<yarp::os::Bottle>
618618
sentiment_analysis.addString(sentence); //add the sentence
619619
yarp::os::Bottle* sentiment = wordList.get(0).asList()->get(element-1).asList();
620620
//yInfo() << "sentiment " << sentiment->toString();//Sentiment (Score 0.100000001490116119385) (Magnitude 0.100000001490116119385)
621-
double score = sentiment->get(1).asList()->get(1).asDouble();
622-
double magnitude = sentiment->get(2).asList()->get(1).asDouble();
621+
double score = sentiment->get(1).asList()->get(1).asFloat64();
622+
double magnitude = sentiment->get(2).asList()->get(1).asFloat64();
623623
//printf("Values: %f %f\n", score, magnitude);
624624
yarp::os::Bottle &each_score = sentiment_analysis.addList();
625625
each_score.addString("Score"); //add the corresponding score
626-
each_score.addDouble(score);
626+
each_score.addFloat64(score);
627627
yarp::os::Bottle &each_magnitude = sentiment_analysis.addList();
628628
each_magnitude.addString("Magnitude"); //add the corresponding magnitude
629-
each_magnitude.addDouble(magnitude);
629+
each_magnitude.addFloat64(magnitude);
630630

631631

632632

speechInteraction/modules/googleSynthesis/main.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,8 @@ class Module : public yarp::os::RFModule, public googleSynthesis_IDL
316316
std::string language = rf.check("language", yarp::os::Value("en-US"), "language to use (string)").asString();
317317
std::string voice = rf.check("voice", yarp::os::Value("en-US-Wavenet-D"), "voice to use (string)").asString();
318318

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

322322
if (rf.check("languageCodes", "Getting language codes"))
323323
{

speechRecognizer/src/SpeechRecognizerModule.cpp

+10-10
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ std::vector<std::string> split(const std::string &s, char delim) {
5353
bool SpeechRecognizerModule::configure(ResourceFinder &rf )
5454
{
5555
setName( rf.check("name",Value("speechRecognizer")).asString().c_str() );
56-
m_timeout = rf.check("timeout",Value(10000)).asInt();
56+
m_timeout = rf.check("timeout",Value(10000)).asInt32();
5757
USE_LEGACY = !rf.check("noLegacy");
5858
m_forwardSound = rf.check("forwardSound");
5959
m_tmpFileFolder = rf.getHomeContextPath();
@@ -265,7 +265,7 @@ bool SpeechRecognizerModule::updateModule()
265265
//Send over yarp
266266
Bottle bOut;
267267
bOut.addString(fullSentence);
268-
bOut.addInt(confidence);
268+
bOut.addInt32(confidence);
269269
m_portContinuousRecognition.write(bOut);
270270

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

663663
if (firstVocab == "timeout")
664664
{
665-
m_timeout = cmd.get(1).asInt();
666-
//reply.addInt(true);
665+
m_timeout = cmd.get(1).asInt32();
666+
//reply.addInt32(true);
667667
return false;
668668
}
669669

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

717717
refreshFromVocabulories(m_cpGrammarRuntime);
718718

719-
//reply.addInt(everythingIsFine);
719+
//reply.addInt32(everythingIsFine);
720720
}
721721

722722
else if (firstVocab == "choices")
@@ -758,7 +758,7 @@ bool SpeechRecognizerModule::handleRecognitionCmd(const Bottle& cmd, Bottle& rep
758758
for(list< pair<string, double> >::iterator it = results.begin(); it != results.end(); it++)
759759
{
760760
reply.addString(it->first);
761-
reply.addDouble(it->second);
761+
reply.addFloat64(it->second);
762762
}
763763
else
764764
reply.addString("-1");
@@ -882,7 +882,7 @@ void SpeechRecognizerModule::say(string s, bool wait)
882882
if(wait)
883883
{
884884
yarp::os::Bottle cmd,reply;
885-
cmd.addVocab(VOCAB('s','t','a','t'));
885+
cmd.addVocab32(VOCAB('s','t','a','t'));
886886
std::string status = "speaking";
887887
bool speechStarted = false;
888888
while(wait&&(!speechStarted ||status=="speaking"))

svox-speech/speech.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ bool Speech::open(yarp::os::Searchable &config)
8282
return false;
8383
}
8484

85-
setPitch(config.check("pitch",Value(90)).asInt());
86-
setSpeed(config.check("speed",Value(105)).asInt());
85+
setPitch(config.check("pitch",Value(90)).asInt32());
86+
setSpeed(config.check("speed",Value(105)).asInt32());
8787

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

0 commit comments

Comments
 (0)