gazebosim / gz-mujoco

28 stars 4 forks source link

MJCF to SDFormat: Do not create non-static models that have no links. #77

Closed azeey closed 2 years ago

azeey commented 2 years ago

🦟 Bug fix

Summary

When converting an MJCF file with a single geom in worldbody, we currently end up creating a non-static model that has no links. But SDFormat requires all models except static ones to have at least one link. The solution here is to check if we've converted any bodies before adding the model to the world. I think it's okay to only check the number of links because model's can't have lights or sensors and joints would only be created if either the parent or child link is in the model.

Checklist

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.

🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸

codecov[bot] commented 2 years ago

Codecov Report

Merging #77 (7018325) into main (b3b464e) will increase coverage by 0.00%. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main      #77   +/-   ##
=======================================
  Coverage   95.16%   95.16%           
=======================================
  Files          24       24           
  Lines        1096     1097    +1     
=======================================
+ Hits         1043     1044    +1     
  Misses         53       53           
Impacted Files Coverage Δ
...sdformat_mjcf/mjcf_to_sdformat/converters/world.py 98.71% <100.00%> (+0.01%) :arrow_up:

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 b3b464e...7018325. Read the comment docs.