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

sdformat_to_mjcf: set friction parameter #70

Merged
merged 10 commits into from
Jun 14, 2022
Merged

Conversation

scpeters
Copy link
Member

@scpeters scpeters commented Jun 9, 2022

🎉 New feature

Part of #12.

Summary

Mujoco supports three friction parameters for a given geom as an array: [sliding_friction, torsional_friction, rolling_friction]. The pull request maps the //surface/friction/ode/mu parameter to the sliding_friction value. I've added a test and an example world with sliding boxes of varying friction coefficients.

Test it

  • Run the sdformat_to_mjcf/tests/test_add_geometry.py test.
  • Example world: sdformat_to_mjcf/tests/resources/friction_demo.sdf
    • gazebo --verbose sdformat_to_mjcf/tests/resources/friction_demo.sdf
    • Convert sdformat_to_mjcf/tests/resources/friction_demo.sdf to mjcf with sdformat2mjcf sdformat_to_mjcf/tests/resources/friction_demo.sdf friction_demo_converted.xml and simulated it with MuJoCo.

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

scpeters added 3 commits June 8, 2022 17:16
Boxes sliding with different friction coefficients

Signed-off-by: Steve Peters <[email protected]>
Apply friction coefficient when converting
to mjcf geometry. Add test for friction.
Add missing doc-string to converter.

Signed-off-by: Steve Peters <[email protected]>
Signed-off-by: Steve Peters <[email protected]>
@codecov
Copy link

codecov bot commented Jun 9, 2022

Codecov Report

Merging #70 (d29e739) into main (56704dd) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main      #70   +/-   ##
=======================================
  Coverage   98.84%   98.85%           
=======================================
  Files          21       21           
  Lines        1992     2008   +16     
=======================================
+ Hits         1969     1985   +16     
  Misses         23       23           
Impacted Files Coverage Δ
...t_mjcf/tests/sdformat_to_mjcf/test_add_geometry.py 99.48% <100.00%> (+0.04%) ⬆️
...jcf/tests/sdformat_to_mjcf/test_name_collisions.py 95.58% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 56704dd...d29e739. Read the comment docs.

@scpeters scpeters force-pushed the scpeters/friction_params branch from 62a42a6 to b9138c4 Compare June 9, 2022 07:17
@scpeters
Copy link
Member Author

scpeters commented Jun 9, 2022

I don't understand why b9138c4 didn't fix the coverage complaint

Copy link
Collaborator

@azeey azeey left a comment

Choose a reason for hiding this comment

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

LGTM! Just a couple of minor comments.

sdformat_to_mjcf/sdformat_to_mjcf/converters/geometry.py Outdated Show resolved Hide resolved
sdformat_to_mjcf/sdformat_to_mjcf/converters/geometry.py Outdated Show resolved Hide resolved
@scpeters scpeters merged commit eedd2e7 into main Jun 14, 2022
@scpeters scpeters deleted the scpeters/friction_params branch June 14, 2022 22:20
@scpeters scpeters mentioned this pull request Jun 16, 2022
9 tasks
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.

2 participants