Skip to content

Commit

Permalink
better exceptions and warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
rosen.diankov@gmail.com committed Mar 12, 2024
1 parent 53c3f46 commit bc16ced
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/libopenrave/kinbody.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2193,21 +2193,21 @@ void KinBody::SetDOFValues(const dReal* pJointValues, int dof, uint32_t checklim
if( p[i] < lowerlimit ) {
if( p[i] < lowerlimit-g_fEpsilonEvalJointLimit ) {
if( checklimits == CLA_CheckLimits ) {
RAVELOG_WARN(str(boost::format("env=%s, dof %d value %.16e is smaller than the lower limit %.16e")%GetEnv()->GetId()%(joint.GetDOFIndex()+i)%p[i]%lowerlimit));
RAVELOG_WARN(str(boost::format("env=%s, joint '%s' dofindex %d value %.16e is smaller than the lower limit %.16e")%GetEnv()->GetNameId()%joint.GetName()%(joint.GetDOFIndex()+i)%p[i]%lowerlimit));
}
else if( checklimits == CLA_CheckLimitsThrow ) {
throw OPENRAVE_EXCEPTION_FORMAT(_("env=%s, dof %d value %.16e is smaller than the lower limit %.16e"), GetEnv()->GetId()%(joint.GetDOFIndex()+i)%p[i]%lowerlimit, ORE_InvalidArguments);
throw OPENRAVE_EXCEPTION_FORMAT(_("env=%s, joint '%s' dofindex %d value %.16e is smaller than the lower limit %.16e"), GetEnv()->GetNameId()%joint.GetName()%(joint.GetDOFIndex()+i)%p[i]%lowerlimit, ORE_InvalidArguments);
}
}
*ptempjoints++ = lowerlimit;
}
else if( p[i] > upperlimit ) {
if( p[i] > upperlimit+g_fEpsilonEvalJointLimit ) {
if( checklimits == CLA_CheckLimits ) {
RAVELOG_WARN_FORMAT("env=%d, dof %d value %.16e is greater than the upper limit %.16e", GetEnv()->GetId()%(joint.GetDOFIndex()+i)%p[i]%upperlimit);
RAVELOG_WARN_FORMAT("env=%s, joint '%s' dofindex %d value %.16e is greater than the upper limit %.16e", GetEnv()->GetNameId()%joint.GetName()%(joint.GetDOFIndex()+i)%p[i]%upperlimit);
}
else if( checklimits == CLA_CheckLimitsThrow ) {
throw OPENRAVE_EXCEPTION_FORMAT(_("env=%d, dof %d value %.16e is greater than the upper limit %.16e"), GetEnv()->GetId()%(joint.GetDOFIndex()+i)%p[i]%upperlimit, ORE_InvalidArguments);
throw OPENRAVE_EXCEPTION_FORMAT(_("env=%s, joint '%s' dofindex %d value %.16e is greater than the upper limit %.16e"), GetEnv()->GetNameId()%joint.GetName()%(joint.GetDOFIndex()+i)%p[i]%upperlimit, ORE_InvalidArguments);
}
}
*ptempjoints++ = upperlimit;
Expand Down

0 comments on commit bc16ced

Please sign in to comment.