gazebosim / gz-mujoco

27 stars 4 forks source link

Add support for `compiler.eulerseq="xyz"` #90

Closed azeey closed 2 years ago

azeey commented 2 years ago

🎉 New feature

Summary

By default MJCF uses Euler angles with the xyz convention (rotation in x, followed by new/local y, followed by new/local z), but SDFormat uses XYZ (rotation in x, followed by global y, followed by global z). MJCF also supports other euler conventions via compiler.eulerseq, but supporting all the other conventions is not trivial. I'll create an issue to track that.

TODO:

Test it

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.

scpeters commented 2 years ago

is there a particular example world that would illustrate this difference?

ahcorde commented 2 years ago

is there a particular example world that would illustrate this difference?

manipulator.xml ?

azeey commented 2 years ago

Yes, manipulator.xml is a good one.

Here's one for experimenting with different parameters

<mujoco model="test_model">
  <!--<compiler eulerseq="XYZ"/>-->

  <default>
    <geom type="capsule" size="0.02"/>
  </default>
  <asset>
    <texture name="grid" type="2d" builtin="checker" width="512" height="512" rgb1=".1 .2 .3" rgb2=".2 .3 .4"/>
    <material name="grid" texture="grid" texrepeat="1 1" texuniform="true" reflectance=".2"/>
  </asset>
  <visual>
    <headlight diffuse="1 1 1"/>
  </visual>
  <worldbody>
    <geom name="floor" size="0 0 0.005" type="plane" material="grid"/>

    <body name="fixed_axes" pos="0 0 0">
      <geom name="X" fromto="0 0 0 10 0 0" rgba="1 0 0 1"/>
      <geom name="Y" fromto="0 0 0 0.0 10 0" rgba="0 1 0 1"/>
      <geom name="Z" fromto="0 0 0 0.0 0.0 10" rgba="0 0 1 1"/>
    </body>

    <body name="axes" pos="1 1 1" euler="0 90 30" >
      <geom name="x" fromto="0 0 0 0.3 0 0" rgba="1 0 0 1"/>
      <geom name="y" fromto="0 0 0 0.0 0.3 0" rgba="0 1 0 1"/>
      <geom name="z" fromto="0 0 0 0.0 0.0 0.3" rgba="0 0 1 1"/>
    </body>
  </worldbody>
</mujoco>
azeey commented 2 years ago

@azeey we should merge this one too

Added a test in https://github.com/gazebosim/gz-mujoco/pull/90/commits/dfd7192af552ed691af87760deec4aa77fc61f25. Can you PTAL?

codecov[bot] commented 2 years ago

Codecov Report

Merging #90 (c7a30a8) into main (658eef8) will increase coverage by 0.02%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main      #90      +/-   ##
==========================================
+ Coverage   95.08%   95.11%   +0.02%     
==========================================
  Files          24       24              
  Lines        1159     1166       +7     
==========================================
+ Hits         1102     1109       +7     
  Misses         57       57              
Impacted Files Coverage Δ
sdformat_mjcf/src/sdformat_mjcf/utils/sdf_utils.py 91.05% <100.00%> (+0.53%) :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 658eef8...c7a30a8. Read the comment docs.