-
Notifications
You must be signed in to change notification settings - Fork 287
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 secondary friction coefficient parameter #1424
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1424 +/- ##
==========================================
- Coverage 57.98% 57.98% -0.01%
==========================================
Files 412 412
Lines 29794 29832 +38
==========================================
+ Hits 17277 17299 +22
- Misses 12517 12533 +16
|
I've removed the WIP from the title since I think this is now ready for review. |
I have a proposed fix for the osx CI in #1426 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just have a few small tweak requests, but otherwise I'm totally fine with these changes.
@jslee02 Do you have any problem with having the secondary friction parameter added?
const double frictionCoeff = 1.0, const double restitutionCoeff = 0.0); | ||
const double primaryFrictionCoeff = 1.0, | ||
const double restitutionCoeff = 0.0, | ||
const double secondaryFrictionCoeff = 1.0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of adding another function argument with a default of 1.0, I recommend overloading like this:
/// The frictionCoeff argument will be used for both primary and secondary friction
DynamicsAspectProperties(
const double frictionCoeff = 1.0,
const double restitutionCoeff = 0.0);
DynamicsAspectProperties(
const double primaryFrictionCoeff,
const double secondaryFrictionCoeff,
const double restitutionCoeff);
I think this should be more intuitive and also should also maintain backwards compatibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -114,14 +114,21 @@ ContactConstraint::ContactConstraint( | |||
//---------------------------------------------- | |||
// TODO(JS): Assume the frictional coefficient can be changed during | |||
// simulation steps. | |||
// Update mFrictionalCoff | |||
// Update mFrictionCoeff | |||
const double frictionCoeffA = computeFrictionCoefficient(shapeNodeA); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const double frictionCoeffA = computeFrictionCoefficient(shapeNodeA); | |
const double primaryFrictionCoeffA = computeFrictionCoefficient(shapeNodeA); |
Nitpick: I know it'll make for a bigger diff, but I think I'd recommend adding primary
to these variable names for better symmetry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename mFrictionCoeff to mPrimaryFrictionCoeff and replace auto-generated (set|get)FrictionCoeff with custom functions that set both coefficients and return the average of the coefficients.
f001b59
to
2a0934f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two comments on style and backward compatibility. Otherwise, looks great to me!
/// Coefficient of friction | ||
double mFrictionCoeff; | ||
/// Primary coefficient of friction | ||
double mPrimaryFrictionCoeff; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This breaks backward compatibility since we're changing the name of the public member variable. Could we keep the variable name and add custom functions (i.e., set/getPrimaryFrictionCoeff
) to DynamicAspect
instead of DART_COMMON_SET_GET_ASPECT_PROPERTY(double, PrimaryFrictionCoeff)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-Authored-By: Jeongseok Lee <[email protected]>
Add secondary friction coefficient parameter (dartsim#1424)
Currently the ContactConstraint uses a friction pyramid with 2 directions, and it uses the same friction coefficient in each direction. We have found it useful in gazebo to be able to specify different values in each direction (anisotropic wheel friction for example). As such, I've added
mSecondaryFrictionCoeff
to the ShapeNode DynamicsAspect and updated the ContactConstraint to use this secondary coefficient. @azeey and I have additional code in his fork that adds parameters for specifying the friction directions and slip parameters, which will be addressed in subsequent pull requests.[edited] To avoid a behavior change, the
mFrictionCoeff
member variable in the ShapeFrame DynamicsAspect is renamed tomPrimaryFrictionCoeff
along with its auto-generated get/set functions. The existing auto-generatedgetFrictionCoeff
andsetFrictionCoeff
are explicitly implemented such thatsetFrictionCoeff
sets both friction parameters andgetFrictionCoeff
returns the average (and also returnsdouble
instead ofconst double &
). I've added test coverage for these new functions. We have test cases in gazebo demonstrating anisotropic friction in case you'd like to add one here in the future.Before creating a pull request
clang-format
Before merging a pull request
CHANGELOG.md