Skip to content

Commit

Permalink
Fetch limits from robot, set in solver device
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterBowman committed Feb 21, 2018
1 parent 6063082 commit 92daeb5
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions programs/transCoords/TransCoords.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include <yarp/os/Value.h>
#include <yarp/os/Property.h>
#include <yarp/dev/ControlBoardInterfaces.h>

#include <ColorDebug.hpp>

Expand Down Expand Up @@ -90,6 +91,29 @@ bool TransCoords::configure(yarp::os::ResourceFinder &rf)
return false;
}

yarp::dev::IControlLimits * iControlLimits;

if (!robotDevice.view(iControlLimits))
{
CD_ERROR("Could not view iControlLimits.\n");
return false;
}

std::vector<double> qMin, qMax;

for (int i = 0; i < numRobotJoints; i++)
{
double min, max;
iControlLimits->getLimits(i, &min, &max);
qMin.push_back(min);
qMax.push_back(max);
}

if (qMin[0] != qMax[0])
{
iCartesianSolver->setLimits(qMin, qMax);
}

CD_SUCCESS("numRobotJoints: %d.\n", numRobotJoints);
}
else
Expand Down

0 comments on commit 92daeb5

Please sign in to comment.