Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add force dependent slip #1505

Merged
merged 9 commits into from
Dec 29, 2020
Merged

Add force dependent slip #1505

merged 9 commits into from
Dec 29, 2020

Conversation

azeey
Copy link
Contributor

@azeey azeey commented Sep 21, 2020

This adds force dependent slip similar to the implementation in ODE. This is a follow up to #1424 and adds slip compliance in the primary and secondary friction directions. I had to add code to count up the number of contacts between two objects since this information is not exposed by dart::collision::CollisionResult. It might be possible to have the collision detector add this to dart::collision::CollisionResult, but I opted for a solution that doesn't need to break ABI.

Relevant forum post: https://dartsim.discourse.group/t/would-dart-be-able-to-support-slip/85

/cc @scpeters


Before creating a pull request

  • Document new methods and classes
  • Format new code files using clang-format

Before merging a pull request

  • Set version target by selecting a milestone on the right side
  • Summarize this change in CHANGELOG.md
  • Add unit test(s) for this change

Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
The failing test expectation was that the bodies were at rest. Instead,
the velocities of the bodies fluctuated unpredictably with a large enough
velocity that made the test flaky. I believe the root cause is the use
of a plane shape with the FCL collision detector.

Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
@azeey
Copy link
Contributor Author

azeey commented Sep 28, 2020

test_Issue1445 was failing on CI, but not reliably on my local machine. I think it was flaky and should be fixed by 7125d19. I printed out the velocity of model2Body right before the failing expectation. Before the fix, the velocity seems to fluctuate unpredictably

Running main() from /home/addisu/ws/dart-pr/src/dart/unittests/gtest/src/gtest_main.cc
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from Issue1445
[ RUN      ] Issue1445.Collision
�[1;33mWarning [FCLCollisionDetector.cpp:1028]�[0m [FCLCollisionDetector] PlaneShape is not supported by FCLCollisionDetector. We create a thin box mesh insted, where the size is [1000 0 1000].
model2Body vel: -0.000185423 -0.000707703 -0.000876478
model2Body vel: 0.000361414 -0.00155453  -0.0024264
model2Body vel: -0.000650413 -0.000627193  -0.00149109
model2Body vel:   2.3053e-05 -0.000621491 -0.000184048
model2Body vel: -0.000457704 -0.000627014  -0.00139063
model2Body vel:  2.62388e-05 -0.000217434 -0.000406549
model2Body vel: -0.000402299 -0.000563603  -0.00155437
model2Body vel: -0.000280635  -0.00169548 -0.000600548
model2Body vel:  3.43346e-05 -0.000239448 -0.000344492
model2Body vel:  3.93007e-05 -0.000220182 -0.000320707
model2Body vel: -0.000525533 -0.000619402   -0.0015581
model2Body vel: -0.000259045  -0.00183708 -0.000417536
model2Body vel:  -5.1458e-05 -0.000714838 -0.000185634
model2Body vel: -1.32935e-05 -0.000140027  -0.00026142
model2Body vel: -5.21894e-05 -0.000707587 -0.000183426
model2Body vel: -1.54931e-05  -0.00015959 -0.000228328
model2Body vel: -5.20875e-05 -0.000394696 -0.000475019
model2Body vel:  -5.2526e-05 -0.000393453 -0.000473937
model2Body vel: -5.25269e-05 -0.000392046 -0.000472163
model2Body vel:  2.86489e-05  -0.00015238 -0.000225958
model2Body vel:  2.84755e-05 -0.000151329 -0.000224713
model2Body vel:  3.02595e-05 -0.000130599 -0.000219135
model2Body vel:   6.2127e-06  -7.0763e-05 -2.97765e-05
model2Body vel:  4.72875e-05 -0.000463026 -6.62565e-05
model2Body vel:  5.50538e-06 -6.23493e-05 -2.62376e-05
model2Body vel:  3.46201e-05  -0.00069831 -5.52697e-05
model2Body vel: -3.20395e-06 -0.000150985 -2.51019e-05
model2Body vel: -3.19392e-06 -0.000149793 -2.52475e-05
model2Body vel:  1.09022e-05 -0.000691729 -5.26147e-05
model2Body vel: -2.63005e-06 -0.000135978 -2.26193e-05
model2Body vel: -1.19489e-06 -4.35652e-05 -2.49755e-05
model2Body vel:  1.08087e-05 -0.000688781 -5.18371e-05
model2Body vel:  -3.4461e-06 -0.000137711 -2.45042e-05
model2Body vel: -3.43206e-06 -0.000136594  -2.4641e-05
model2Body vel: -5.74693e-06 -0.000134015 -2.52836e-05
model2Body vel:  6.14966e-06 -0.000696077 -5.75175e-05
model2Body vel:  1.55312e-05 -0.000100041 -0.000216031
model2Body vel: -6.90569e-06  -0.00013623 -2.76074e-05
model2Body vel:  3.35984e-05 -0.000341451 -0.000513016
model2Body vel:  3.39503e-05 -0.000340336 -0.000512851
model2Body vel:  3.39731e-05  -0.00033921 -0.000512216
model2Body vel:  4.73825e-05 -0.000175203 -0.000502313
model2Body vel:   4.7359e-05 -0.000174101 -0.000502198
model2Body vel:  4.74046e-05 -0.000172991 -0.000502029
model2Body vel:  1.70079e-05 -2.29147e-05 -0.000247926
model2Body vel:  1.57177e-05 -1.40825e-05 -0.000247323
model2Body vel:  4.71307e-05  -0.00017096 -0.000510464
model2Body vel: -4.29868e-06 -2.42921e-05 -2.78668e-05
model2Body vel: -4.35249e-06 -2.37404e-05 -2.76677e-05
model2Body vel:  4.68305e-05 -0.000168354 -0.000508967
model2Body vel:  2.43678e-05 -0.000396314 -6.93176e-05
model2Body vel: -4.41698e-06 -1.95596e-05 -2.74201e-05
model2Body vel: -4.33937e-06 -1.90427e-05 -2.77292e-05
model2Body vel: -4.33933e-06 -1.85192e-05 -2.77441e-05
model2Body vel: -4.33979e-06 -1.79971e-05 -2.77574e-05
model2Body vel: -4.37097e-06 -1.74767e-05 -2.77745e-05
model2Body vel: -4.48777e-06 -1.69582e-05 -2.78014e-05
model2Body vel:    2.397e-05 -0.000384444 -6.65744e-05
model2Body vel:  -4.8254e-06 -1.36025e-05 -2.74335e-05
model2Body vel: -4.76919e-06 -1.31039e-05 -2.76101e-05
model2Body vel: -6.38738e-07 -0.000263972 -1.06301e-06
model2Body vel: -1.67214e-07  3.18388e-05 -1.27804e-07
model2Body vel: -1.66303e-07  3.19512e-05 -1.26239e-07
model2Body vel: -6.26633e-07 -0.000262663 -5.59355e-07
model2Body vel: -1.68481e-07  3.29586e-05 -1.28807e-07
model2Body vel: -1.67745e-07  3.30582e-05 -1.27692e-07
model2Body vel: -6.44578e-07 -0.000261911 -5.77622e-07
model2Body vel:  -7.1145e-07 -0.000263292 -6.49446e-07
model2Body vel: -7.80094e-07 -0.000262374 -7.17257e-07
model2Body vel: -1.73403e-07  3.55965e-05 -1.33398e-07
model2Body vel: -6.99518e-07  -0.00025909 -6.30273e-07
model2Body vel: -2.35794e-07 -0.000112454 -0.000500708
model2Body vel:  8.78828e-07   3.5265e-05 -0.000242898
model2Body vel:  8.76425e-07  3.54516e-05 -0.000242328
model2Body vel: -2.90771e-07 -0.000110771 -0.000494906
model2Body vel:  8.70434e-07  3.59787e-05 -0.000241029
model2Body vel:  8.68154e-07  3.61537e-05 -0.000240454
model2Body vel: -3.77753e-07 -0.000109521 -0.000494859
model2Body vel:    8.606e-07  3.66675e-05 -0.000239314
model2Body vel:  8.57378e-07   3.6849e-05 -0.000238862
model2Body vel: -4.65028e-07 -0.000108256 -0.000494897
model2Body vel:  8.48429e-07  3.73786e-05 -0.000237862
model2Body vel:  8.4531e-07   3.756e-05 -0.00023742
model2Body vel: -5.51698e-07 -0.000107004 -0.000494854
model2Body vel:  8.35032e-07  4.27708e-05 -0.000236431
model2Body vel:  8.32076e-07   4.2947e-05 -0.000235997
model2Body vel: -6.38202e-07 -0.000105759 -0.000494849
model2Body vel:  8.23775e-07  4.34762e-05 -0.000235008
model2Body vel:  8.20906e-07  4.36773e-05 -0.000234582
model2Body vel: -7.26217e-07 -0.000104504 -0.000494858
model2Body vel: -7.31324e-07 -0.000103965  -0.00049519
model2Body vel: -1.27245e-06 -0.000104536 -0.000507203
model2Body vel: -1.30377e-06 -0.000103966 -0.000507027
model2Body vel: -1.33693e-06 -0.000103382 -0.000506887
model2Body vel:  -1.9776e-06 -0.000103445 -0.000514821
model2Body vel: -2.00765e-06 -0.000102878 -0.000514618
model2Body vel:   -1.527e-06 -0.000103009 -0.000521883
model2Body vel: -1.55628e-06 -0.000102445 -0.000521698
model2Body vel: -1.58773e-06 -0.000101874 -0.000521535
model2Body vel: -4.77332e-06  -0.00010141 -0.000529852
[       OK ] Issue1445.Collision (231 ms)
[----------] 1 test from Issue1445 (231 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (231 ms total)
[  PASSED  ] 1 test.

The fix was to replace the plane shape for the ground skeleton with a box shape. The velocities seem much more reasonable

Running main() from /home/addisu/ws/dart-pr/src/dart/unittests/gtest/src/gtest_main.cc
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from Issue1445
[ RUN      ] Issue1445.Collision
model2Body vel: 1.50089e-15 4.13949e-09  6.0373e-09
model2Body vel: 4.45116e-09 3.66089e-09 4.86756e-09
model2Body vel: -1.34315e-09  1.01825e-13  1.78844e-09
model2Body vel: 5.52899e-10  1.8702e-14  2.3891e-09
model2Body vel:   3.3479e-15 -8.58896e-17  2.36521e-09
model2Body vel: 1.07266e-18 5.31298e-19 2.34156e-09
model2Body vel: 5.05783e-19 2.35657e-18 2.31814e-09
model2Body vel: -1.66471e-19    3.157e-18  2.29496e-09
model2Body vel: 2.46215e-19 5.41996e-19 2.27201e-09
model2Body vel:   2.4279e-19 -9.75675e-20  2.24929e-09
model2Body vel: 5.49204e-19 1.88866e-18  2.2268e-09
model2Body vel:  1.03232e-19 -1.50659e-18  2.20453e-09
model2Body vel:  2.35926e-19 -2.13477e-18  2.18249e-09
model2Body vel: 2.33885e-19 2.57613e-18 2.16066e-09
model2Body vel:  1.09809e-18 -2.18724e-18  2.13906e-09
model2Body vel: -2.06535e-19 -1.30577e-18  2.11766e-09
model2Body vel: 2.27081e-19  7.6664e-20 2.09649e-09
model2Body vel:  2.25107e-19 -2.39896e-18  2.07552e-09
model2Body vel: 2.90131e-19 7.21102e-19 2.05477e-09
model2Body vel:  7.47712e-20 -1.89422e-18  2.03422e-09
model2Body vel:  2.17944e-19 -4.61155e-19  2.01388e-09
model2Body vel:  2.15759e-19 -2.73739e-18  1.99374e-09
model2Body vel: 8.46146e-19 4.74491e-18  1.9738e-09
model2Body vel:  6.13787e-19 -2.19951e-18  1.95406e-09
model2Body vel:  2.09825e-19 -1.46305e-18  1.93452e-09
model2Body vel: -3.40397e-19  1.65222e-14  1.91518e-09
model2Body vel: 1.15057e-18 8.00618e-19 1.89603e-09
model2Body vel:  7.09917e-16 -5.75232e-16  1.87706e-09
model2Body vel: 3.31993e-16 5.18875e-17  1.8583e-09
model2Body vel:  3.46769e-19 -7.44015e-18  1.83971e-09
model2Body vel: -2.6024e-20 5.62696e-19 1.82132e-09
model2Body vel: -7.93664e-17  -4.6216e-16   1.8031e-09
model2Body vel:  2.13805e-19 -3.72133e-19  1.78507e-09
model2Body vel:  2.38021e-19 -7.94701e-19  1.76722e-09
model2Body vel: 6.52778e-19 1.11482e-18 1.74955e-09
model2Body vel: 7.06857e-19 4.14854e-18 1.73205e-09
model2Body vel:  2.31312e-19 -3.18257e-18  1.71473e-09
model2Body vel:  2.2871e-19 1.58597e-18 1.69759e-09
model2Body vel:   3.0354e-19 -4.82866e-19  1.68061e-09
model2Body vel: -1.3278e-19 2.70283e-18  1.6638e-09
model2Body vel:   2.2427e-19 -5.47172e-18  1.64716e-09
model2Body vel:  2.23076e-19 -2.85984e-18  1.63069e-09
model2Body vel:  3.52317e-19 -1.07536e-18  1.61439e-09
model2Body vel: -8.20387e-20  2.12269e-18  1.59824e-09
model2Body vel:  2.16333e-19 -2.53499e-19  1.58226e-09
model2Body vel: -6.22656e-17 -3.58469e-16  1.56644e-09
model2Body vel:  8.10456e-19 -7.07855e-19  1.55077e-09
model2Body vel:   7.4117e-19 -1.56817e-18  1.53527e-09
model2Body vel:  2.01258e-19 -1.05359e-18  1.51991e-09
model2Body vel: 2.35408e-16 4.09651e-16 1.50471e-09
model2Body vel:  5.30388e-20 -3.00412e-19  1.48967e-09
model2Body vel:  1.34189e-19 -8.68551e-19  1.47477e-09
model2Body vel:  1.82716e-19 -4.95214e-19  1.46002e-09
model2Body vel: 1.80671e-19 2.00122e-18 1.44542e-09
model2Body vel:  1.61427e-19 -6.25094e-18  1.43097e-09
model2Body vel: -3.60127e-16 -2.57206e-16  1.41666e-09
model2Body vel: 6.71192e-20  3.2999e-18 1.40249e-09
model2Body vel:  1.58962e-19 -1.12642e-18  1.38847e-09
model2Body vel: -3.94321e-19 -1.72787e-18  1.37458e-09
model2Body vel:  3.55436e-19 -5.45864e-19  1.36084e-09
model2Body vel: 1.52956e-19 1.06976e-18 1.34723e-09
model2Body vel: 1.52919e-19 1.02291e-19 1.33376e-09
model2Body vel: -5.70187e-19 -7.40229e-19  1.32042e-09
model2Body vel:  5.61116e-19 -2.50182e-18  1.30721e-09
model2Body vel:  1.47939e-19 -3.87269e-18  1.29414e-09
model2Body vel:  1.46357e-19 -4.50592e-19   1.2812e-09
model2Body vel: -5.18396e-19 -4.92079e-18  1.26839e-09
model2Body vel:  4.33242e-19 -1.27863e-18   1.2557e-09
model2Body vel:   1.4103e-19 -6.90249e-18  1.24315e-09
model2Body vel: 1.40506e-19 -8.7454e-19 1.23072e-09
model2Body vel: -1.50487e-19 -3.20956e-18  1.21841e-09
model2Body vel: -1.29913e-19 -1.42089e-18  1.20622e-09
model2Body vel:  1.36104e-19 -1.43451e-18  1.19416e-09
model2Body vel: 1.36308e-19 1.57608e-18 1.18222e-09
model2Body vel: 4.29554e-20 1.15951e-19  1.1704e-09
model2Body vel: -4.04064e-19  9.16208e-19  1.15869e-09
model2Body vel:  1.32104e-19 -3.01013e-19  1.14711e-09
model2Body vel:  1.30824e-19 -2.52002e-18  1.13564e-09
model2Body vel: -2.15486e-19 -6.93517e-19  1.12428e-09
model2Body vel:  3.63185e-19 -1.14871e-18  1.11304e-09
model2Body vel: 1.26443e-19 6.43781e-19 1.10191e-09
model2Body vel:   1.2631e-19 -3.17669e-19  1.09089e-09
model2Body vel:  -2.4911e-19 -1.81578e-18  1.07998e-09
model2Body vel: -9.77187e-20 -1.57172e-18  1.06918e-09
model2Body vel:  1.21562e-19 -2.40389e-18  1.05849e-09
model2Body vel: 1.20769e-19 -6.1106e-19  1.0479e-09
model2Body vel: -5.97045e-21 -8.05672e-19  1.03742e-09
model2Body vel: 3.16539e-19 1.15881e-18 1.02705e-09
model2Body vel: -2.80398e-16   5.6873e-16  1.01678e-09
model2Body vel:  4.5163e-20     2.8e-18 1.00661e-09
model2Body vel: 3.82494e-20 3.58085e-18 9.96545e-10
model2Body vel:  3.5931e-19 1.88896e-18 9.86579e-10
model2Body vel:  1.19476e-19 -5.65435e-19  9.76714e-10
model2Body vel: 1.17781e-19 4.74881e-19 9.66946e-10
model2Body vel: 5.45147e-19  1.2241e-18 9.57277e-10
model2Body vel:  2.51379e-19 -1.30498e-18  9.47704e-10
model2Body vel: 1.15012e-19 2.52017e-18 9.38227e-10
model2Body vel: 1.13908e-19 1.27841e-18 9.28845e-10
model2Body vel: 2.49486e-19 6.19079e-19 9.19556e-10
model2Body vel: 2.59742e-19 1.29335e-18 9.10361e-10
[       OK ] Issue1445.Collision (185 ms)
[----------] 1 test from Issue1445 (185 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (185 ms total)
[  PASSED  ] 1 test.

@scpeters
Copy link
Collaborator

we are hoping that these changes could be included in 6.10.0, since we have been using them in our fork of dart for inn-physics and osrf/subt

@jslee02 jslee02 self-assigned this Sep 28, 2020
@jslee02 jslee02 added this to the DART 6.10.0 milestone Sep 28, 2020
…tructor overload

Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
@codecov
Copy link

codecov bot commented Sep 28, 2020

Codecov Report

Merging #1505 (551ad63) into master (41dac54) will increase coverage by 0.11%.
The diff coverage is 84.05%.

@@            Coverage Diff             @@
##           master    #1505      +/-   ##
==========================================
+ Coverage   58.17%   58.28%   +0.11%     
==========================================
  Files         414      414              
  Lines       30008    30077      +69     
==========================================
+ Hits        17456    17530      +74     
+ Misses      12552    12547       -5     
Impacted Files Coverage Δ
dart/constraint/ContactConstraint.hpp 100.00% <ø> (ø)
dart/dynamics/ShapeFrame.cpp 72.22% <ø> (ø)
dart/dynamics/detail/ShapeFrameAspect.hpp 88.88% <ø> (ø)
dart/constraint/ContactConstraint.cpp 69.86% <77.55%> (+0.96%) ⬆️
dart/constraint/ConstraintSolver.cpp 68.36% <100.00%> (+2.06%) ⬆️
dart/dynamics/ShapeFrame.hpp 85.71% <100.00%> (+2.38%) ⬆️
dart/collision/fcl/FCLCollisionDetector.cpp 84.83% <0.00%> (-0.79%) ⬇️
dart/dynamics/Skeleton.cpp 66.39% <0.00%> (+0.16%) ⬆️
dart/collision/CollisionGroup.cpp 82.30% <0.00%> (+0.41%) ⬆️
dart/dynamics/BodyNode.cpp 78.71% <0.00%> (+1.45%) ⬆️
... and 1 more

Copy link
Member

@jslee02 jslee02 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this feature, and sorry for the late review. Left a few style comments and a comment about the allowed slip value.

dart/constraint/ContactConstraint.hpp Outdated Show resolved Hide resolved
dart/constraint/ContactConstraint.hpp Outdated Show resolved Hide resolved
dart/constraint/ConstraintSolver.cpp Outdated Show resolved Hide resolved
}
};

std::map<ContactPair, size_t, ContactPairCompare> contactPairMap;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using std::unordered_map as the order of the pair doesn't matter in the use cases

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opted for using a std::map because I thought a writing a compare function was easier than writing a hash function. If you think performance would be a problem, I can look into a hash function for ContactPair and using std::unordered_map.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using std::unordered_map would increase the performance since the find query will be called per contact constraints for every simulation step. But it's not critical for this PR. Let's save it for a future change.

dart/constraint/ConstraintSolver.cpp Show resolved Hide resolved
dart/constraint/ContactConstraint.cpp Show resolved Hide resolved
dart/dynamics/detail/ShapeFrameAspect.hpp Outdated Show resolved Hide resolved
dart/dynamics/detail/ShapeFrameAspect.hpp Outdated Show resolved Hide resolved
}

double slipCompliance = dynamicAspect->getSlipCompliance();
if (slipCompliance < 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct me if I'm wrong. It seems a negative slip also makes sense, unlike friction. For example, a rotating tire could make slip either left or right.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand slip compliance to be similar to a linear damping coefficient (actually the inverse, see gazebo's WheelSlipPlugin documentation), with a positive value corresponding to a dissipative effect. A negative value, on the other hand, would be non-dissipative and non-physical, similar to having a negative coefficient of friction.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I agree with @scpeters. In the rotating tire example, the tire can slip left or right, but that will be determined by the force applied on the tire. The slip velocity will always be in the same direction as the net external force. A negative slip parameter would mean a velocity opposite to the net external force, which seems non-physical.

Quoting from the ODE manual:

FDS is an effect that causes the contacting surfaces to side past each other with a velocity that is proportional to the force that is being applied tangentially to that surface.

Consider a contact point where the coefficient of friction mu is infinite. Normally, if a force f is applied to the two contacting surfaces, to try and get them to slide past each other, they will not move. However, if the FDS coefficient is set to a positive value k then the surfaces will slide past each other, building up to a steady velocity of kf relative to each other.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me. Thanks for the explanation

Comment on lines +563 to +566
contactConstraint->setPrimarySlipCompliance(
contactConstraint->getPrimarySlipCompliance() * numContacts);
contactConstraint->setSecondarySlipCompliance(
contactConstraint->getSecondarySlipCompliance() * numContacts);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you let me know why we need to multiply the slip compliance by the number of contacts?

If I understand correctly, the slip effect will be applied per contact anyway when there were multiple contacts for the same object pair. Suppose we have two contacts for the same object pair and multiply the slip compliance by two, then the doubled slip effect will happen at the two contact points.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A similar change was made in gazebosim/gazebo-classic@402b9d3 (see also bitbucket PR 2965). The analogy between slip and linear damping is useful here as well. Each contact point with slip acts like an extra damper acting in parallel, which increases the total slip acting on the body. This multiplication aims to make the total slip invariant of the number of contact points.

Copy link
Member

@jslee02 jslee02 Dec 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This description seems very useful. Could we add a note about that something like these lines?

    // The slip compliance acts like a damper at each contact point so the total
    // damping for each collision is multiplied by the number of contact points
    // (numContacts). To eliminate this dependence on numContacts, the inverse
    // damping is multiplied by numContacts.

I tried to edit it myself, but it seems the fork doesn't exist anymore. If that's the case then it's okay to merge this as it is and then add the comment in a new PR.

Never mind, it's edited.

Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
@scpeters
Copy link
Collaborator

@jslee02 do you think there's a chance to include this in dart? Let me know if it needs more explanation or motivation.

Copy link
Member

@jslee02 jslee02 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@scpeters @azeey Sorry for the late response. Added some minor comments.

}

double slipCompliance = dynamicAspect->getSlipCompliance();
if (slipCompliance < 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me. Thanks for the explanation

Comment on lines +563 to +566
contactConstraint->setPrimarySlipCompliance(
contactConstraint->getPrimarySlipCompliance() * numContacts);
contactConstraint->setSecondarySlipCompliance(
contactConstraint->getSecondarySlipCompliance() * numContacts);
Copy link
Member

@jslee02 jslee02 Dec 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This description seems very useful. Could we add a note about that something like these lines?

    // The slip compliance acts like a damper at each contact point so the total
    // damping for each collision is multiplied by the number of contact points
    // (numContacts). To eliminate this dependence on numContacts, the inverse
    // damping is multiplied by numContacts.

I tried to edit it myself, but it seems the fork doesn't exist anymore. If that's the case then it's okay to merge this as it is and then add the comment in a new PR.

Never mind, it's edited.

}
};

std::map<ContactPair, size_t, ContactPairCompare> contactPairMap;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using std::unordered_map would increase the performance since the find query will be called per contact constraints for every simulation step. But it's not critical for this PR. Let's save it for a future change.

@jslee02 jslee02 merged commit 2ed52c3 into dartsim:master Dec 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants