Skip to content

Commit

Permalink
upgrade to yarp-3.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
pattacini committed Nov 22, 2021
1 parent 23ac254 commit bac8da0
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 79 deletions.
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set(PROJECTNAME icub-tutorials)

project(${PROJECTNAME})

find_package(YARP 3.3.2 REQUIRED COMPONENTS os sig dev math gsl idl_tools)
find_package(YARP 3.5.1 REQUIRED COMPONENTS os sig dev math gsl idl_tools)
find_package(ICUB REQUIRED)
list(APPEND CMAKE_MODULE_PATH ${ICUB_MODULE_PATH})

Expand Down
16 changes: 8 additions & 8 deletions src/actionPrimitives/tutorial_actionPrimitives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ class ExampleModule: public RFModule
int l=len<sz?len:sz;

for (int i=0; i<l; i++)
_gOrien[i]=pB->get(i).asDouble();
_gOrien[i]=pB->get(i).asFloat64();
}

if (Bottle *pB=b.find("grasp_displacement").asList())
Expand All @@ -242,7 +242,7 @@ class ExampleModule: public RFModule
int l=len<sz?len:sz;

for (int i=0; i<l; i++)
_gDisp[i]=pB->get(i).asDouble();
_gDisp[i]=pB->get(i).asFloat64();
}

if (Bottle *pB=b.find("systematic_error_displacement").asList())
Expand All @@ -252,7 +252,7 @@ class ExampleModule: public RFModule
int l=len<sz?len:sz;

for (int i=0; i<l; i++)
_dOffs[i]=pB->get(i).asDouble();
_dOffs[i]=pB->get(i).asFloat64();
}

if (Bottle *pB=b.find("lifting_displacement").asList())
Expand All @@ -262,7 +262,7 @@ class ExampleModule: public RFModule
int l=len<sz?len:sz;

for (int i=0; i<l; i++)
_dLift[i]=pB->get(i).asDouble();
_dLift[i]=pB->get(i).asFloat64();
}

if (Bottle *pB=b.find("home_position").asList())
Expand All @@ -272,7 +272,7 @@ class ExampleModule: public RFModule
int l=len<sz?len:sz;

for (int i=0; i<l; i++)
_home_x[i]=pB->get(i).asDouble();
_home_x[i]=pB->get(i).asFloat64();
}
}

Expand Down Expand Up @@ -384,9 +384,9 @@ class ExampleModule: public RFModule
Vector xd(3);
bool f;

xd[0]=b->get(0).asDouble();
xd[1]=b->get(1).asDouble();
xd[2]=b->get(2).asDouble();
xd[0]=b->get(0).asFloat64();
xd[1]=b->get(1).asFloat64();
xd[2]=b->get(2).asFloat64();

// apply systematic offset
// due to uncalibrated kinematic
Expand Down
2 changes: 1 addition & 1 deletion src/anyRobotCartesianInterface/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
cmake_minimum_required(VERSION 3.5)
project(anyRobotCartesianInterface)

find_package(YARP 3.2.101 REQUIRED)
find_package(YARP 3.5.1 REQUIRED)
find_package(ICUB)

set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}" CACHE PATH "Installation directory" FORCE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@ bool fakeMotorDeviceClient::getLimits(int axis, double *min, double *max)
return false;

Bottle cmd,reply;
cmd.addVocab(Vocab::encode("lim"));
cmd.addVocab(Vocab::encode("get"));
cmd.addInt(axis);
cmd.addVocab32("lim");
cmd.addVocab32("get");
cmd.addInt32(axis);
if (rpcPort.write(cmd,reply))
{
*min=reply.get(1).asDouble();
*max=reply.get(2).asDouble();
*min=reply.get(1).asFloat64();
*max=reply.get(2).asFloat64();

return true;
}
Expand All @@ -114,11 +114,11 @@ bool fakeMotorDeviceClient::getAxes(int *ax)
return false;

Bottle cmd,reply;
cmd.addVocab(Vocab::encode("enc"));
cmd.addVocab(Vocab::encode("axes"));
cmd.addVocab32("enc");
cmd.addVocab32("axes");
if (rpcPort.write(cmd,reply))
{
*ax=reply.get(1).asInt();
*ax=reply.get(1).asInt32();
return true;
}
else
Expand All @@ -145,10 +145,10 @@ bool fakeMotorDeviceClient::velocityMove(int j, double sp)
return false;

Bottle cmd,reply;
cmd.addVocab(Vocab::encode("vel"));
cmd.addVocab(Vocab::encode("move"));
cmd.addInt(j);
cmd.addDouble(sp);
cmd.addVocab32("vel");
cmd.addVocab32("move");
cmd.addInt32(j);
cmd.addFloat64(sp);
if (rpcPort.write(cmd,reply))
return true;
else
Expand All @@ -162,10 +162,10 @@ bool fakeMotorDeviceClient::setRefAcceleration(int j, double acc)
return false;

Bottle cmd,reply;
cmd.addVocab(Vocab::encode("vel"));
cmd.addVocab(Vocab::encode("acc"));
cmd.addInt(j);
cmd.addDouble(acc);
cmd.addVocab32("vel");
cmd.addVocab32("acc");
cmd.addInt32(j);
cmd.addFloat64(acc);
if (rpcPort.write(cmd,reply))
return true;
else
Expand All @@ -179,9 +179,9 @@ bool fakeMotorDeviceClient::stop(int j)
return false;

Bottle cmd,reply;
cmd.addVocab(Vocab::encode("vel"));
cmd.addVocab(Vocab::encode("stop"));
cmd.addInt(j);
cmd.addVocab32("vel");
cmd.addVocab32("stop");
cmd.addInt32(j);
if (rpcPort.write(cmd,reply))
return true;
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ bool fakeMotorDeviceServer::open(Searchable &config)
printf("Opening Fake Motor Device Server ...\n");

string local=config.check("local",Value("/fakeyServer")).asString();
int Ts=config.check("Ts",Value(10)).asInt();
int Ts=config.check("Ts",Value(10)).asInt32();

statePort.open(local+"/state:o");
cmdPort.open(local+"/cmd:i");
Expand Down Expand Up @@ -112,7 +112,7 @@ void fakeMotorDeviceServer::run()
{
if ((size_t)cmd->size()>=vel.length())
for (size_t i=0; i<vel.length(); i++)
vel[i]=cmd->get(i).asDouble();
vel[i]=cmd->get(i).asFloat64();
}

statePort.prepare()=motors->integrate(vel);
Expand All @@ -127,61 +127,61 @@ bool fakeMotorDeviceServer::read(ConnectionReader &connection)

mtx.lock();

int codeIF=cmd.get(0).asVocab();
int codeMethod=cmd.get(1).asVocab();
int codeIF=cmd.get(0).asVocab32();
int codeMethod=cmd.get(1).asVocab32();

if (codeIF==Vocab::encode("lim"))
if (codeIF==Vocab32::encode("lim"))
{
if (codeMethod==Vocab::encode("get"))
if (codeMethod==Vocab32::encode("get"))
{
int axis=cmd.get(2).asInt();
int axis=cmd.get(2).asInt32();
double min,max;
if (getLimits(axis,&min,&max))
{
reply.addVocab(Vocab::encode("ack"));
reply.addDouble(min);
reply.addDouble(max);
reply.addVocab32("ack");
reply.addFloat64(min);
reply.addFloat64(max);
}
}
}
else if (codeIF==Vocab::encode("enc"))
else if (codeIF==Vocab32::encode("enc"))
{
if (codeMethod==Vocab::encode("axes"))
if (codeMethod==Vocab32::encode("axes"))
{
int ax;
if (getAxes(&ax))
{
reply.addVocab(Vocab::encode("ack"));
reply.addInt(ax);
reply.addVocab32("ack");
reply.addInt32(ax);
}
}
}
else if (codeIF==Vocab::encode("vel"))
else if (codeIF==Vocab32::encode("vel"))
{
if (codeMethod==Vocab::encode("move"))
if (codeMethod==Vocab32::encode("move"))
{
int axis=cmd.get(2).asInt();
double sp=cmd.get(3).asDouble();
int axis=cmd.get(2).asInt32();
double sp=cmd.get(3).asFloat64();
if (velocityMove(axis,sp))
reply.addVocab(Vocab::encode("ack"));
reply.addVocab32("ack");
}
else if (codeMethod==Vocab::encode("acc"))
else if (codeMethod==Vocab32::encode("acc"))
{
int axis=cmd.get(2).asInt();
double acc=cmd.get(3).asDouble();
int axis=cmd.get(2).asInt32();
double acc=cmd.get(3).asFloat64();
if (setRefAcceleration(axis,acc))
reply.addVocab(Vocab::encode("ack"));
reply.addVocab32("ack");
}
else if (codeMethod==Vocab::encode("stop"))
else if (codeMethod==Vocab32::encode("stop"))
{
int axis=cmd.get(2).asInt();
int axis=cmd.get(2).asInt32();
if (stop(axis))
reply.addVocab(Vocab::encode("ack"));
reply.addVocab32("ack");
}
}

if (reply.size()==0)
reply.addVocab(Vocab::encode("nack"));
reply.addVocab32("nack");

mtx.unlock();

Expand Down
22 changes: 11 additions & 11 deletions src/ctrlLib/onlinePTuner/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ int main(int argc, char *argv[])
string name=rf.check("name",Value("tuner")).asString();
string robot=rf.check("robot",Value("icub")).asString();
string part=rf.check("part",Value("right_arm")).asString();
int joint=rf.check("joint",Value(11)).asInt();
double encoder=rf.check("encoder",Value(2.43)).asDouble();
int joint=rf.check("joint",Value(11)).asInt32();
double encoder=rf.check("encoder",Value(2.43)).asFloat64();

Property pOptions;
pOptions.put("device","remote_controlboard");
Expand Down Expand Up @@ -151,7 +151,7 @@ int main(int argc, char *argv[])
designer.startPlantEstimation(pPlantEstimation);

printf("Estimation experiment will last %g seconds...\n",
pPlantEstimation.find("max_time").asDouble());
pPlantEstimation.find("max_time").asFloat64());

double t0=Time::now();
while (!designer.isDone())
Expand All @@ -163,8 +163,8 @@ int main(int argc, char *argv[])
// retrieve the identified values (averaged over time)
Property pResults;
designer.getResults(pResults);
double tau=pResults.find("tau_mean").asDouble();
double K=pResults.find("K_mean").asDouble();
double tau=pResults.find("tau_mean").asFloat64();
double K=pResults.find("K_mean").asFloat64();

printf("plant = K/s * 1/(1+s*tau)\n");
printf("Estimated parameters...\n");
Expand All @@ -188,7 +188,7 @@ int main(int argc, char *argv[])
designer.startPlantValidation(pPlantValidation);

printf("Validation experiment will last %g seconds...\n",
pPlantValidation.find("max_time").asDouble());
pPlantValidation.find("max_time").asFloat64());

t0=Time::now();
while (!designer.isDone())
Expand Down Expand Up @@ -216,7 +216,7 @@ int main(int argc, char *argv[])
pControllerRequirements.put("type","P");
designer.tuneController(pControllerRequirements,pController);
printf("tuning results: %s\n",pController.toString().c_str());
double Kp=pController.find("Kp").asDouble();
double Kp=pController.find("Kp").asFloat64();
printf("found Kp = %g\n",Kp);
int scale=4;
double Kp_fw=Kp*encoder*(1<<scale);
Expand All @@ -233,7 +233,7 @@ int main(int argc, char *argv[])
designer.startStictionEstimation(pStictionEstimation);

printf("Stiction estimation experiment will last no more than %g seconds...\n",
pStictionEstimation.find("max_time").asDouble());
pStictionEstimation.find("max_time").asFloat64());

t0=Time::now();
while (!designer.isDone())
Expand All @@ -245,8 +245,8 @@ int main(int argc, char *argv[])
// retrieve the stiction values
designer.getResults(pResults);
Vector stiction(2);
stiction[0]=pResults.find("stiction").asList()->get(0).asDouble();
stiction[1]=pResults.find("stiction").asList()->get(1).asDouble();
stiction[0]=pResults.find("stiction").asList()->get(0).asFloat64();
stiction[1]=pResults.find("stiction").asList()->get(1).asFloat64();
printf("Stiction values: up = %g; down = %g\n",stiction[0],stiction[1]);

// now that we know P and stiction, let's try out our controller
Expand Down Expand Up @@ -283,7 +283,7 @@ int main(int argc, char *argv[])
designer.startControllerValidation(pControllerValidation);

printf("Controller validation will last %g seconds...\n",
pControllerValidation.find("max_time").asDouble());
pControllerValidation.find("max_time").asFloat64());

t0=Time::now();
while (!designer.isDone())
Expand Down
4 changes: 2 additions & 2 deletions src/iKin/genericChainController/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class inPort : public BufferedPort<Bottle>
vect.resize(b.size());

for (size_t i=0; i<vect.length(); i++)
vect[i]=b.get(i).asDouble();
vect[i]=b.get(i).asFloat64();
}

public:
Expand Down Expand Up @@ -305,7 +305,7 @@ class Controller : public PeriodicThread
ctrl=new MultiRefMinJerkCtrl(*chain,ctrlPose,getPeriod());

// set the task execution time
ctrl->set_execTime(rf.check("T",Value(2.0)).asDouble(),true);
ctrl->set_execTime(rf.check("T",Value(2.0)).asFloat64(),true);

port_v.open("/"+name+"/v:o");
port_x.open("/"+name+"/x:o");
Expand Down
2 changes: 1 addition & 1 deletion src/iKin/iCubLimbsFwKin/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ int main(int argc, char *argv[])
size_t len = std::min(q.length(), (size_t)b->size());
for (size_t i = 0; i < len; i++)
{
q[i] = b->get(i).asDouble();
q[i] = b->get(i).asFloat64();
}
}

Expand Down
Loading

0 comments on commit bac8da0

Please sign in to comment.