Skip to content
This repository has been archived by the owner on Apr 6, 2020. It is now read-only.

Commit

Permalink
Added some checks to avoid floating nans
Browse files Browse the repository at this point in the history
  • Loading branch information
traversaro authored and francesco-romano committed Sep 29, 2017
1 parent fd06d65 commit 30ec03f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/devices/wholeBodyDynamics/WholeBodyDynamicsDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1088,6 +1088,22 @@ bool WholeBodyDynamicsDevice::readFTSensors(bool verbose)
yWarning() << "wholeBodyDynamics warning : FT sensor " << sensorName << " was not readed correctly, using old measurement";
}

bool isNaN = false;
for (size_t i = 0; i < ftMeasurement.size(); i++)
{
if( std::isnan(ftMeasurement[i]) )
{
isNaN = true;
break;
}
}
if( isNaN )
{
std::string sensorName = estimator.sensors().getSensor(iDynTree::SIX_AXIS_FORCE_TORQUE,ft)->getName();
yError() << "wholeBodyDynamics : FT sensor " << sensorName << " contains nan: " << ftMeasurement.toString() << ", returning error.";
return false;
}

if( ok )
{
// Format of F/T measurement in YARP/iDynTree is consistent: linear/angular
Expand Down

0 comments on commit 30ec03f

Please sign in to comment.