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 afef0dc commit 343fa88
Show file tree
Hide file tree
Showing 24 changed files with 198 additions and 198 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ cmake_minimum_required(VERSION 3.5)
project(iCub-Tests)

find_package(RobotTestingFramework 2 COMPONENTS DLL REQUIRED)
find_package(YARP 3.3.2 COMPONENTS os math robottestingframework REQUIRED)
find_package(YARP 3.5.1 COMPONENTS os math robottestingframework REQUIRED)

# set the output plugin directory to collect all the shared libraries
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/plugins)
Expand Down
2 changes: 1 addition & 1 deletion example/cpp/ExampleFixture/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ project(ExampleFixture)

# add the required cmake packages
find_package(RobotTestingFramework 2 COMPONENTS DLL)
find_package(YARP 3.3.0 COMPONENTS os robottestingframework)
find_package(YARP 3.5.1 COMPONENTS os robottestingframework)

# add the source codes to build the plugin library
add_library(${PROJECT_NAME} MODULE ExampleFixture.h
Expand Down
2 changes: 1 addition & 1 deletion example/cpp/ExampleFixture/ExampleFixture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ bool ExampleFixture::setup(int argc, char** argv) {
printf("ExampleFixture: missing 'probability' param.\n");
return false;
}
probability = prop.find("probability").asDouble();
probability = prop.find("probability").asFloat64();
Random::seed(time(NULL));
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion example/cpp/ExampleTest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ project(ExampleTest)

# add the required cmake packages
find_package(RobotTestingFramework 2 COMPONENTS DLL)
find_package(YARP 3.3.0 COMPONENTS os robottestingframework)
find_package(YARP 3.5.1 COMPONENTS os robottestingframework)

# add the source codes to build the plugin library
add_library(${PROJECT_NAME} MODULE ExampleTest.h
Expand Down
6 changes: 3 additions & 3 deletions src/camera/CameraTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ bool CameraTest::setup(yarp::os::Property& property) {
ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(property.check("portname"),
"The portname must be given as the test paramter!");
cameraPortName = property.find("portname").asString();
measure_time = property.check("measure_time") ? property.find("measure_time").asInt() : TIMES;
expected_frequency = property.check("expected_frequency") ? property.find("expected_frequency").asInt() : FREQUENCY;
tolerance = property.check("tolerance") ? property.find("tolerance").asInt() : TOLERANCE;
measure_time = property.check("measure_time") ? property.find("measure_time").asInt32() : TIMES;
expected_frequency = property.check("expected_frequency") ? property.find("expected_frequency").asInt32() : FREQUENCY;
tolerance = property.check("tolerance") ? property.find("tolerance").asInt32() : TOLERANCE;

// opening port
ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(port.open("/CameraTest/image:i"),
Expand Down
18 changes: 9 additions & 9 deletions src/controlModes/ControlModes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ bool ControlModes::setup(yarp::os::Property& property) {
robotName = property.find("robot").asString();
partName = property.find("part").asString();
if(property.check("tolerance"))
tolerance = property.find("tolerance").asDouble();
tolerance = property.find("tolerance").asFloat64();
else
tolerance = 0.5;

Expand Down Expand Up @@ -121,10 +121,10 @@ bool ControlModes::setup(yarp::os::Property& property) {
jointTorqueCtrlEnabled = new int[n_part_joints];
home_pos = new double[n_cmd_joints];

for (int i=0; i <n_cmd_joints; i++) jointsList[i]=jointsBottle->get(i).asInt();
for (int i=0; i <n_cmd_joints; i++) jointsList[i]=jointsBottle->get(i).asInt32();

Bottle* homePosBottle = property.find("home").asList();
for (int i=0; i <n_cmd_joints; i++) home_pos[i]=homePosBottle->get(i).asDouble();
for (int i=0; i <n_cmd_joints; i++) home_pos[i]=homePosBottle->get(i).asFloat64();

checkJointWithTorqueMode();
return true;
Expand Down Expand Up @@ -222,14 +222,14 @@ void ControlModes::verifyMode(int desired_control_mode, yarp::dev::InteractionMo
if (timeout>100)
{
char sbuf[500];
sprintf(sbuf,"Test (%s) failed: current mode is (%s,%s), it should be (%s,%s)",title.c_str(), Vocab::decode((NetInt32)cmode).c_str(), Vocab::decode((NetInt32)imode).c_str(), Vocab::decode((NetInt32)desired_control_mode).c_str(),Vocab::decode((NetInt32)desired_interaction_mode).c_str());
sprintf(sbuf,"Test (%s) failed: current mode is (%s,%s), it should be (%s,%s)",title.c_str(), Vocab32::decode((NetInt32)cmode).c_str(), Vocab32::decode((NetInt32)imode).c_str(), Vocab32::decode((NetInt32)desired_control_mode).c_str(),Vocab32::decode((NetInt32)desired_interaction_mode).c_str());
ROBOTTESTINGFRAMEWORK_ASSERT_ERROR(sbuf);
}
yarp::os::Time::delay(0.2);
timeout++;
}
char sbuf[500];
sprintf(sbuf,"Test (%s) passed: current mode is (%s,%s)",title.c_str(),Vocab::decode((NetInt32)desired_control_mode).c_str(), Vocab::decode((NetInt32)desired_interaction_mode).c_str());
sprintf(sbuf,"Test (%s) passed: current mode is (%s,%s)",title.c_str(),Vocab32::decode((NetInt32)desired_control_mode).c_str(), Vocab32::decode((NetInt32)desired_interaction_mode).c_str());
ROBOTTESTINGFRAMEWORK_TEST_REPORT(sbuf);
}

Expand All @@ -250,14 +250,14 @@ void ControlModes::verifyModeSingle(int joint, int desired_control_mode, yarp::d
if (timeout>100)
{
char sbuf[500];
sprintf(sbuf,"Test (%s) failed: current mode is (%s,%s), it should be (%s,%s)",title.c_str(), Vocab::decode((NetInt32)cmode).c_str(), Vocab::decode((NetInt32)imode).c_str(), Vocab::decode((NetInt32)desired_control_mode).c_str(),Vocab::decode((NetInt32)desired_interaction_mode).c_str());
sprintf(sbuf,"Test (%s) failed: current mode is (%s,%s), it should be (%s,%s)",title.c_str(), Vocab32::decode((NetInt32)cmode).c_str(), Vocab32::decode((NetInt32)imode).c_str(), Vocab32::decode((NetInt32)desired_control_mode).c_str(),Vocab32::decode((NetInt32)desired_interaction_mode).c_str());
ROBOTTESTINGFRAMEWORK_ASSERT_ERROR(sbuf);
}
yarp::os::Time::delay(0.2);
timeout++;
}
char sbuf[500];
sprintf(sbuf,"Test (%s) passed: current mode is (%s,%s)",title.c_str(),Vocab::decode((NetInt32)desired_control_mode).c_str(), Vocab::decode((NetInt32)desired_interaction_mode).c_str());
sprintf(sbuf,"Test (%s) passed: current mode is (%s,%s)",title.c_str(),Vocab32::decode((NetInt32)desired_control_mode).c_str(), Vocab32::decode((NetInt32)desired_interaction_mode).c_str());
ROBOTTESTINGFRAMEWORK_TEST_REPORT(sbuf);
}

Expand All @@ -274,7 +274,7 @@ void ControlModes::checkJointWithTorqueMode()
yarp::os::Bottle *baux = b.get(i).asList();
for(int k=0; k<baux->size()&& j<n_part_joints; k++)
{
jointTorqueCtrlEnabled[j] = baux->get(k).asInt();
jointTorqueCtrlEnabled[j] = baux->get(k).asInt32();
j++;
}
}
Expand Down Expand Up @@ -377,7 +377,7 @@ void ControlModes::checkControlModeWithImCompliant(int desired_control_mode, std
{
if(jointTorqueCtrlEnabled[jointsList[i]])
{
sprintf(buff, "joint %d has torque enabled. try to set %s and im_comp", jointsList[i], Vocab::decode((NetInt32)desired_control_mode).c_str());
sprintf(buff, "joint %d has torque enabled. try to set %s and im_comp", jointsList[i], Vocab32::decode((NetInt32)desired_control_mode).c_str());
ROBOTTESTINGFRAMEWORK_TEST_REPORT(buff);
setModeSingle(jointsList[i],desired_control_mode,VOCAB_IM_COMPLIANT);
verifyModeSingle(jointsList[i], desired_control_mode,VOCAB_IM_COMPLIANT,title);
Expand Down
22 changes: 11 additions & 11 deletions src/demoRedBall/DemoRedBallTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ bool DemoRedBallTest::setup(Property &property)
{
params.robot=general.check("robot",Value(params.robot)).asString();
params.eye=general.check("eye",Value(params.eye)).asString();
params.reach_tol=general.check("reach_tol",Value(params.reach_tol)).asDouble();
params.reach_tol=general.check("reach_tol",Value(params.reach_tol)).asFloat64();
params.use_torso=(general.check("torso",Value(params.use_torso?"on":"off")).asString()=="on");
params.use_left=(general.check("left_arm",Value(params.use_left?"on":"off")).asString()=="on");
params.use_right=(general.check("right_arm",Value(params.use_right?"on":"off")).asString()=="on");
Expand All @@ -99,7 +99,7 @@ bool DemoRedBallTest::setup(Property &property)
{
Bottle &poss=home_arm.findGroup("poss");
for (size_t i=0; i<std::min(params.home_arm.length(),(size_t)poss.size()-1); i++)
params.home_arm[i]=poss.get(1+i).asDouble();
params.home_arm[i]=poss.get(1+i).asFloat64();
}
}

Expand Down Expand Up @@ -209,9 +209,9 @@ bool DemoRedBallTest::getBallPosition(const Bottle* b, Vector& pos)
if (b->get(0).isString() && (b->get(0).asString()=="object"))
{
pos.resize(3);
pos[0]=b->get(5).asDouble()/1000.;
pos[1]=b->get(6).asDouble()/1000.;
pos[2]=b->get(7).asDouble()/1000.;
pos[0]=b->get(5).asFloat64()/1000.;
pos[1]=b->get(6).asFloat64()/1000.;
pos[2]=b->get(7).asFloat64()/1000.;
return true;
}
}
Expand All @@ -229,18 +229,18 @@ void DemoRedBallTest::testBallPosition(const Vector &dpos)

Bottle cmd,rep;
cmd.addString("update_pose");
cmd.addDouble(dpos[0]);
cmd.addDouble(dpos[1]);
cmd.addDouble(dpos[2]);
cmd.addFloat64(dpos[0]);
cmd.addFloat64(dpos[1]);
cmd.addFloat64(dpos[2]);
rpcPort.write(cmd,rep);

Time::delay(3.0);

cmd.clear();
cmd.addString("start");
cmd.addDouble(0.);
cmd.addDouble(-50.);
cmd.addDouble(10.);
cmd.addFloat64(0.);
cmd.addFloat64(-50.);
cmd.addFloat64(10.);
rpcPort.write(cmd,rep);

auto filt = make_unique<MedianFilter>(5, Vector{0., 0., 0.});
Expand Down
14 changes: 7 additions & 7 deletions src/jointLimits/jointLimits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ bool JointLimits::setup(yarp::os::Property& property) {
Bottle* outputLimitBottle = property.find("outputLimitPercent").asList();
ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(outputLimitBottle!=0,"unable to parse speed parameter");

tolerance = property.find("tolerance").asDouble();
tolerance = property.find("tolerance").asFloat64();
ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(tolerance>=0,"invalid tolerance");

Bottle* toleranceListBottle = property.find("toleranceList").asList(); //optional param
Expand All @@ -116,22 +116,22 @@ bool JointLimits::setup(yarp::os::Property& property) {

int n_cmd_joints = jointsBottle->size();
ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(n_cmd_joints>0 && n_cmd_joints<=n_part_joints,"invalid number of joints, it must be >0 & <= number of part joints");
for (int i=0; i <n_cmd_joints; i++) jointsList.push_back(jointsBottle->get(i).asInt());
for (int i=0; i <n_cmd_joints; i++) jointsList.push_back(jointsBottle->get(i).asInt32());

enc_jnt.resize(n_part_joints);
max_lims.resize(n_cmd_joints);
min_lims.resize(n_cmd_joints);

home.resize (n_cmd_joints); for (int i=0; i< n_cmd_joints; i++) home[i]=homeBottle->get(i).asDouble();
speed.resize(n_cmd_joints); for (int i=0; i< n_cmd_joints; i++) speed[i]=speedBottle->get(i).asDouble();
outputLimit.resize(n_cmd_joints);for (int i=0; i< n_cmd_joints; i++) outputLimit[i]=outputLimitBottle->get(i).asDouble();
outOfBoundPos.resize(n_cmd_joints); for (int i = 0; i < n_cmd_joints; i++) { outOfBoundPos[i] = outOfBoundPosition->get(i).asDouble(); ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(outOfBoundPos[i] > 0 , "outOfBoundPosition must be > 0"); }
home.resize (n_cmd_joints); for (int i=0; i< n_cmd_joints; i++) home[i]=homeBottle->get(i).asFloat64();
speed.resize(n_cmd_joints); for (int i=0; i< n_cmd_joints; i++) speed[i]=speedBottle->get(i).asFloat64();
outputLimit.resize(n_cmd_joints);for (int i=0; i< n_cmd_joints; i++) outputLimit[i]=outputLimitBottle->get(i).asFloat64();
outOfBoundPos.resize(n_cmd_joints); for (int i = 0; i < n_cmd_joints; i++) { outOfBoundPos[i] = outOfBoundPosition->get(i).asFloat64(); ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(outOfBoundPos[i] > 0 , "outOfBoundPosition must be > 0"); }
toleranceList.resize(n_cmd_joints);
for (int i = 0; i < n_cmd_joints; i++)
{
if(toleranceListBottle)
{
toleranceList[i] = toleranceListBottle->get(i).asDouble();
toleranceList[i] = toleranceListBottle->get(i).asFloat64();
ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(toleranceList[i] >= 0 , "toleranceList must be > 0");
}
else
Expand Down
26 changes: 13 additions & 13 deletions src/motor-stiction/MotorStiction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ bool MotorStiction::setup(yarp::os::Property& property) {
robotName = property.find("robot").asString();
partName = property.find("part").asString();

repeat = property.find("repeat").asInt();
repeat = property.find("repeat").asInt32();
ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(repeat>=0,"repeat must be greater than zero");

Bottle* homeBottle = property.find("home").asList();
Expand Down Expand Up @@ -113,13 +113,13 @@ bool MotorStiction::setup(yarp::os::Property& property) {

int n_cmd_joints = jointsBottle->size();
ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(n_cmd_joints>0 && n_cmd_joints<=n_part_joints,"invalid number of joints, it must be >0 & <= number of part joints");
for (int i=0; i <n_cmd_joints; i++) jointsList.push_back(jointsBottle->get(i).asInt());
for (int i=0; i <n_cmd_joints; i++) jointsList.push_back(jointsBottle->get(i).asInt32());

home.resize (n_cmd_joints); for (int i=0; i< n_cmd_joints; i++) home[i]=homeBottle->get(i).asDouble();
opl_step.resize (n_cmd_joints); for (int i=0; i< n_cmd_joints; i++) opl_step[i]=output_step_Bottle->get(i).asDouble();
opl_delay.resize (n_cmd_joints); for (int i=0; i< n_cmd_joints; i++) opl_delay[i]=output_delay_Bottle->get(i).asDouble();
opl_max.resize (n_cmd_joints); for (int i=0; i< n_cmd_joints; i++) opl_max[i]=output_max_Bottle->get(i).asDouble();
movement_threshold.resize (n_cmd_joints); for (int i=0; i< n_cmd_joints; i++) movement_threshold[i]=threshold_Bottle->get(i).asDouble();
home.resize (n_cmd_joints); for (int i=0; i< n_cmd_joints; i++) home[i]=homeBottle->get(i).asFloat64();
opl_step.resize (n_cmd_joints); for (int i=0; i< n_cmd_joints; i++) opl_step[i]=output_step_Bottle->get(i).asFloat64();
opl_delay.resize (n_cmd_joints); for (int i=0; i< n_cmd_joints; i++) opl_delay[i]=output_delay_Bottle->get(i).asFloat64();
opl_max.resize (n_cmd_joints); for (int i=0; i< n_cmd_joints; i++) opl_max[i]=output_max_Bottle->get(i).asFloat64();
movement_threshold.resize (n_cmd_joints); for (int i=0; i< n_cmd_joints; i++) movement_threshold[i]=threshold_Bottle->get(i).asFloat64();

max_lims.resize(n_cmd_joints);
min_lims.resize(n_cmd_joints);
Expand Down Expand Up @@ -299,9 +299,9 @@ void MotorStiction::OplExecute(int i, std::vector<yarp::os::Bottle>& dataToPlotL
}

time = yarp::os::Time::now();
v1.addDouble(time);
v2.addDouble(enc);
v2.addDouble(opl);
v1.addFloat64(time);
v2.addFloat64(enc);
v2.addFloat64(opl);
yarp::os::Time::delay(0.010);

if (time-time_old>5.0 && not_moving==true)
Expand Down Expand Up @@ -369,9 +369,9 @@ void MotorStiction::OplExecute2(int i, std::vector<yarp::os::Bottle>& dataToPlot
}

time = yarp::os::Time::now();
v1.addDouble(time);
v2.addDouble(enc);
v2.addDouble(opl);
v1.addFloat64(time);
v2.addFloat64(enc);
v2.addFloat64(opl);
yarp::os::Time::delay(0.010);

if (time-time_old>5.0 && not_moving==true)
Expand Down
14 changes: 7 additions & 7 deletions src/motor-tests/MotorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ bool MotorTest::setup(yarp::os::Property &configuration) {

ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(configuration.check("joints"),
"Missing 'joints' parameter, cannot open device");
m_NumJoints=configuration.find("joints").asInt();
m_NumJoints=configuration.find("joints").asInt32();

ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(configuration.check("target"),
"Missing 'target' parameter, cannot open device");
Expand All @@ -72,7 +72,7 @@ bool MotorTest::setup(yarp::os::Property &configuration) {
m_aTargetVal=new double[m_NumJoints];
m_aHome=new double [m_NumJoints];
for (int i=0; i<n; ++i) {
m_aTargetVal[i]=bot.get(i).asDouble();
m_aTargetVal[i]=bot.get(i).asFloat64();
m_aHome[i]=0.0;
}

Expand All @@ -82,30 +82,30 @@ bool MotorTest::setup(yarp::os::Property &configuration) {
n = m_NumJoints<bot.size()?m_NumJoints:bot.size();
m_aMinErr=new double[m_NumJoints];
for (int i=0; i<n; ++i)
m_aMinErr[i]=bot.get(i).asDouble();
m_aMinErr[i]=bot.get(i).asFloat64();

ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(configuration.check("max"),
"Missing 'max' parameter, cannot open device");
bot=configuration.findGroup("max").tail();
n = m_NumJoints<bot.size()? m_NumJoints:bot.size();
m_aMaxErr=new double[m_NumJoints];
for (int i=0; i<n; ++i)
m_aMaxErr[i]=bot.get(i).asDouble();
m_aMaxErr[i]=bot.get(i).asFloat64();

ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(configuration.check("refvel"),
"Missing 'max' parameter, cannot open device");
bot = configuration.findGroup("refvel").tail();
n = m_NumJoints<bot.size()?m_NumJoints:bot.size();
m_aRefVel=new double[m_NumJoints];
for (int i=0; i<n; ++i)
m_aRefVel[i]=bot.get(i).asDouble();
m_aRefVel[i]=bot.get(i).asFloat64();

if(configuration.check("refacc")) {
bot = configuration.findGroup("refacc").tail();
n = m_NumJoints<bot.size()?m_NumJoints:bot.size();
m_aRefAcc=new double[m_NumJoints];
for (int i=0; i<n; ++i)
m_aRefAcc[i]=bot.get(i).asDouble();
m_aRefAcc[i]=bot.get(i).asFloat64();
}

ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(configuration.check("timeout"),
Expand All @@ -114,7 +114,7 @@ bool MotorTest::setup(yarp::os::Property &configuration) {
n = m_NumJoints<bot.size()?m_NumJoints:bot.size();
m_aTimeout = new double[m_NumJoints];
for (int i=0; i<n; ++i)
m_aTimeout[i]=bot.get(i).asDouble();
m_aTimeout[i]=bot.get(i).asFloat64();

// opening interfaces
yarp::os::Property options;
Expand Down
Loading

0 comments on commit 343fa88

Please sign in to comment.