Skip to content

Commit e76d3bf

Browse files
committed
Print warnings on solver/actuator failures
1 parent 3bb6d70 commit e76d3bf

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

libraries/YarpPlugins/BasicCartesianControl/RateThreadImpl.cpp

+18-4
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,16 @@ void roboticslab::BasicCartesianControl::handleGcmp()
215215

216216
std::vector<double> t(numRobotJoints);
217217

218-
iCartesianSolver->invDyn(currentQ, t);
218+
if (!iCartesianSolver->invDyn(currentQ, t))
219+
{
220+
CD_WARNING("invDyn failed, not updating control this iteration.\n");
221+
return;
222+
}
219223

220-
iTorqueControl->setRefTorques(t.data());
224+
if (!iTorqueControl->setRefTorques(t.data()))
225+
{
226+
CD_WARNING("setRefTorques failed, not updating control this iteration.\n");
227+
}
221228
}
222229

223230
// -----------------------------------------------------------------------------
@@ -246,9 +253,16 @@ void roboticslab::BasicCartesianControl::handleForc()
246253

247254
std::vector<double> t(numRobotJoints);
248255

249-
iCartesianSolver->invDyn(currentQ, qdot, qdotdot, fexts, t);
256+
if (!iCartesianSolver->invDyn(currentQ, qdot, qdotdot, fexts, t))
257+
{
258+
CD_WARNING("invDyn failed, not updating control this iteration.\n");
259+
return;
260+
}
250261

251-
iTorqueControl->setRefTorques(t.data());
262+
if (!iTorqueControl->setRefTorques(t.data()))
263+
{
264+
CD_WARNING("setRefTorques failed, not updating control this iteration.\n");
265+
}
252266
}
253267

254268
// -----------------------------------------------------------------------------

0 commit comments

Comments
 (0)