Created
August 19, 2020 00:49
-
-
Save scpeters/3873d509867e6b6ea98bf32236b7f3a7 to your computer and use it in GitHub Desktop.
tighten tolerances in force-dependent slip PR
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/unittests/comprehensive/test_ForceDependentSlip.cpp b/unittests/comprehensive/test_ForceDependentSlip.cpp | |
index 5833a00dbe..7a53c297e2 100644 | |
--- a/unittests/comprehensive/test_ForceDependentSlip.cpp | |
+++ b/unittests/comprehensive/test_ForceDependentSlip.cpp | |
@@ -146,12 +146,12 @@ TEST(ForceDependentSlip, BoxSlipVelocity) | |
if (i > 1000) | |
{ | |
// The velocity of body1 should stabilize at F_ext * slip = 0.2 m/s | |
- EXPECT_NEAR(extForce * slip, body1->getLinearVelocity().x(), 1e-4); | |
- EXPECT_NEAR(0.0, body1->getLinearVelocity().y(), 1e-4); | |
+ EXPECT_NEAR(extForce * slip, body1->getLinearVelocity().x(), 2e-5); | |
+ EXPECT_NEAR(0.0, body1->getLinearVelocity().y(), 2e-5); | |
// The second box should remain at rest because of friction | |
- EXPECT_NEAR(0.0, body2->getLinearVelocity().x(), 1e-4); | |
- EXPECT_NEAR(0.0, body2->getLinearVelocity().y(), 1e-4); | |
+ EXPECT_NEAR(0.0, body2->getLinearVelocity().x(), 2e-5); | |
+ EXPECT_NEAR(0.0, body2->getLinearVelocity().y(), 2e-5); | |
} | |
} | |
@@ -168,12 +168,12 @@ TEST(ForceDependentSlip, BoxSlipVelocity) | |
{ | |
world->step(); | |
} | |
- EXPECT_NEAR(0.0, body1->getLinearVelocity().x(), 1e-4); | |
- EXPECT_NEAR(0.0, body1->getLinearVelocity().y(), 1e-4); | |
+ EXPECT_NEAR(0.0, body1->getLinearVelocity().x(), 2e-5); | |
+ EXPECT_NEAR(0.0, body1->getLinearVelocity().y(), 2e-5); | |
// The second box should remain at rest because of friction | |
- EXPECT_NEAR(0.0, body2->getLinearVelocity().x(), 1e-4); | |
- EXPECT_NEAR(0.0, body2->getLinearVelocity().y(), 1e-4); | |
+ EXPECT_NEAR(0.0, body2->getLinearVelocity().x(), 2e-5); | |
+ EXPECT_NEAR(0.0, body2->getLinearVelocity().y(), 2e-5); | |
// Apply force in the +y direction | |
for (auto i = 0u; i < numSteps; ++i) | |
@@ -185,12 +185,12 @@ TEST(ForceDependentSlip, BoxSlipVelocity) | |
if (i > 1500) | |
{ | |
// The velocity of body1 should stabilize at F_ext * slip2 = 0.3 m/s | |
- EXPECT_NEAR(0.0, body1->getLinearVelocity().x(), 1e-4); | |
- EXPECT_NEAR(extForce * slip2, body1->getLinearVelocity().y(), 1e-4); | |
+ EXPECT_NEAR(0.0, body1->getLinearVelocity().x(), 2e-5); | |
+ EXPECT_NEAR(extForce * slip2, body1->getLinearVelocity().y(), 2e-5); | |
// The second box should remain at rest because of friction | |
- EXPECT_NEAR(0.0, body2->getLinearVelocity().x(), 1e-4); | |
- EXPECT_NEAR(0.0, body2->getLinearVelocity().y(), 1e-4); | |
+ EXPECT_NEAR(0.0, body2->getLinearVelocity().x(), 2e-5); | |
+ EXPECT_NEAR(0.0, body2->getLinearVelocity().y(), 2e-5); | |
} | |
} | |
} | |
@@ -257,8 +257,8 @@ TEST(ForceDependentSlip, CylinderSlipVelocity) | |
if (i > 1000) | |
{ | |
// The velocity of body1 should stabilize at F_ext * slip | |
- EXPECT_NEAR(extForceX * slip, body1->getLinearVelocity().x(), 1e-4); | |
- EXPECT_NEAR(0.0, body1->getLinearVelocity().y(), 1e-4); | |
+ EXPECT_NEAR(extForceX * slip, body1->getLinearVelocity().x(), 3e-5); | |
+ EXPECT_NEAR(0.0, body1->getLinearVelocity().y(), 3e-5); | |
// // body2 rolls with sliding. The difference between the linear velocity | |
// and the expected non-sliding velocity (angular velocity * radius) is | |
@@ -271,8 +271,8 @@ TEST(ForceDependentSlip, CylinderSlipVelocity) | |
// of the body using (BodyNode::getLinearAcceleration), so we compute it | |
// here via finite difference. | |
auto accel = (body2->getLinearVelocity() - lastVel) / dt; | |
- EXPECT_NEAR(mass * accel.x() * slip, spinVel - linVel, 1e-4); | |
- EXPECT_NEAR(0.0, body2->getLinearVelocity().y(), 1e-4); | |
+ EXPECT_NEAR(mass * accel.x() * slip, spinVel - linVel, 3e-5); | |
+ EXPECT_NEAR(0.0, body2->getLinearVelocity().y(), 3e-5); | |
} | |
lastVel = body2->getLinearVelocity(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment