Skip to content

Commit 92daeb5

Browse files
committed
Fetch limits from robot, set in solver device
#145
1 parent 6063082 commit 92daeb5

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

programs/transCoords/TransCoords.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#include <yarp/os/Value.h>
77
#include <yarp/os/Property.h>
8+
#include <yarp/dev/ControlBoardInterfaces.h>
89

910
#include <ColorDebug.hpp>
1011

@@ -90,6 +91,29 @@ bool TransCoords::configure(yarp::os::ResourceFinder &rf)
9091
return false;
9192
}
9293

94+
yarp::dev::IControlLimits * iControlLimits;
95+
96+
if (!robotDevice.view(iControlLimits))
97+
{
98+
CD_ERROR("Could not view iControlLimits.\n");
99+
return false;
100+
}
101+
102+
std::vector<double> qMin, qMax;
103+
104+
for (int i = 0; i < numRobotJoints; i++)
105+
{
106+
double min, max;
107+
iControlLimits->getLimits(i, &min, &max);
108+
qMin.push_back(min);
109+
qMax.push_back(max);
110+
}
111+
112+
if (qMin[0] != qMax[0])
113+
{
114+
iCartesianSolver->setLimits(qMin, qMax);
115+
}
116+
93117
CD_SUCCESS("numRobotJoints: %d.\n", numRobotJoints);
94118
}
95119
else

0 commit comments

Comments
 (0)