Skip to content

Commit

Permalink
Make tmp driver and interfaces members of the class and fix names
Browse files Browse the repository at this point in the history
  • Loading branch information
martinaxgloria committed Jan 24, 2024
1 parent ad31d2e commit a9b26df
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
11 changes: 2 additions & 9 deletions src/imu/imu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ bool Imu::setup(yarp::os::Property& property)
yarp::os::Bottle axesNames;
yarp::os::Bottle & axesList = axesNames.addList();

yarp::dev::PolyDriver tmpDriver;
yarp::dev::IEncoders* tmpEncoders;
yarp::dev::IAxisInfo* tmpAxis;

yarp::os::Property tmpOptions;

int tmpAxisNum;
Expand Down Expand Up @@ -116,10 +112,10 @@ bool Imu::setup(yarp::os::Property& property)
for (int i = 0; i < axes; i++)
{
ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(iaxes->getAxisName(i, axisName), "Cannot get the name of controlled axes");
axis.push_back(axisName);
axesVec.push_back(axisName);
}

ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(model.loadReducedModelFromFile(modelAbsolutePath.c_str(), axis), Asserter::format("Cannot load model from %s", modelAbsolutePath.c_str()));
ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(model.loadReducedModelFromFile(modelAbsolutePath.c_str(), axesVec), Asserter::format("Cannot load model from %s", modelAbsolutePath.c_str()));
kinDynComp.loadRobotModel(model.model());

iDynTree::Vector3 baseLinkOrientationRad;
Expand Down Expand Up @@ -178,9 +174,6 @@ void Imu::run()
double minLim;
double maxLim;

yarp::dev::PolyDriver tmpDriver;
yarp::dev::IEncoders* tmpEncoders;
yarp::dev::IAxisInfo* tmpAxis;
yarp::os::Property tmpOptions;

int tmpAxisNum;
Expand Down
6 changes: 5 additions & 1 deletion src/imu/imu.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,18 @@ class Imu : public yarp::robottestingframework::TestCase {
yarp::dev::IAxisInfo* iaxes;
yarp::dev::IControlLimits* ilim;

yarp::dev::PolyDriver tmpDriver;
yarp::dev::IEncoders* tmpEncoders;
yarp::dev::IAxisInfo* tmpAxis;

yarp::os::BufferedPort <yarp::os::Bottle> outputPort;
yarp::sig::Vector rpyValues;
yarp::sig::Vector positions;
yarp::sig::Vector velocities;

int axes;
double timestamp;
std::vector<std::string> axis;
std::vector<std::string> axesVec;

iDynTree::ModelLoader model;
iDynTree::KinDynComputations kinDynComp;
Expand Down

0 comments on commit a9b26df

Please sign in to comment.