Skip to content

Commit

Permalink
Accomodate DART 6.9
Browse files Browse the repository at this point in the history
Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
  • Loading branch information
azeey committed Jul 22, 2021
1 parent b22bfea commit 4984cec
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
16 changes: 16 additions & 0 deletions dartsim/src/JointFeatures.cc
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,11 @@ void JointFeatures::SetJointMinPosition(
<< "]. The command will be ignored\n";
return;
}
#if DART_VERSION_AT_LEAST(6, 10, 0)
joint->setLimitEnforcement(true);
#else
joint->setPositionLimitEnforced(true);
#endif
// We do not check min/max mismatch, we leave that to DART.
joint->setPositionLowerLimit(_dof, _value);
}
Expand All @@ -221,7 +225,11 @@ void JointFeatures::SetJointMaxPosition(
<< "]. The command will be ignored\n";
return;
}
#if DART_VERSION_AT_LEAST(6, 10, 0)
joint->setLimitEnforcement(true);
#else
joint->setPositionLimitEnforced(true);
#endif
// We do not check min/max mismatch, we leave that to DART.
joint->setPositionUpperLimit(_dof, _value);
}
Expand All @@ -242,7 +250,11 @@ void JointFeatures::SetJointMinVelocity(
<< "]. The command will be ignored\n";
return;
}
#if DART_VERSION_AT_LEAST(6, 10, 0)
joint->setLimitEnforcement(true);
#else
joint->setPositionLimitEnforced(true);
#endif
// We do not check min/max mismatch, we leave that to DART.
joint->setVelocityLowerLimit(_dof, _value);
}
Expand All @@ -263,7 +275,11 @@ void JointFeatures::SetJointMaxVelocity(
<< "]. The command will be ignored\n";
return;
}
#if DART_VERSION_AT_LEAST(6, 10, 0)
joint->setLimitEnforcement(true);
#else
joint->setPositionLimitEnforced(true);
#endif
// We do not check min/max mismatch, we leave that to DART.
joint->setVelocityUpperLimit(_dof, _value);
}
Expand Down
2 changes: 2 additions & 0 deletions dartsim/src/JointFeatures_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ TEST_F(JointFeaturesFixture, JointSetPositionLimitsWithForceControl)
EXPECT_LT(pos + 0.5, joint->GetPosition(0));
}

#if DART_VERSION_AT_LEAST(6, 10, 0)
TEST_F(JointFeaturesFixture, JointSetVelocityLimitsWithForceControl)
{
sdf::Root root;
Expand Down Expand Up @@ -632,6 +633,7 @@ TEST_F(JointFeaturesFixture, JointSetCombinedLimitsWithVelocityControl)
}
EXPECT_NEAR(-0.5, joint->GetVelocity(0), 1e-6);
}
#endif

// Test detaching joints.
TEST_F(JointFeaturesFixture, JointDetach)
Expand Down

0 comments on commit 4984cec

Please sign in to comment.