<!-- 
  MJCF fragment for box with lid assembly. Can be used for peg insertion and
  other manipulation tasks.

  Model based on "Melissa & Doug Shape Sorting Cube - Classic Wooden Toy With 12 Shapes"
  Available on Amazon.

  Box has a lid on a prismatic joint to allow opening/closing by inserting a peg
  into one of the holes at the top.
-->

<mujoco>
  <body name="box_base" pos="0.25 0.0 0.005">
    <geom name="box_base:mesh" type="mesh" contype="0" conaffinity="0" rgba="0.87 0.72 0.52 1" mesh="box_body"/>
    <!-- contype/conaffinity set to avoid collision between body and lid geoms -->
    <geom name="box_base:b1" type="box"
      contype="1" conaffinity="1"
      size="0.06985 0.002778 0.06985" pos="0.06985 0.136922 0.06985" rgba="0 0 0 0"/>
    <geom name="box_base:b2" type="box"
      contype="1" conaffinity="1"
      size="0.06985 0.06985 0.002778" pos="0.06985 0.06985 0.0014" rgba="0 0 0 0"/>
    <geom name="box_base:b3" type="box"
      contype="1" conaffinity="1"
      size="0.002778 0.06985 0.06985" pos="0.002778 0.06985 0.06985" rgba="0 0 0 0"/>
    <geom name="box_base:b4" type="box"
      contype="1" conaffinity="1"
      size="0.002778 0.06985 0.06985" pos="0.136922 0.06985 0.06985" rgba="0 0 0 0"/>
    <geom name="box_base:b5" type="box"
      contype="1" conaffinity="1"
      size="0.06985 0.002778 0.06" pos="0.06985 0.002778 0.06" rgba="0 0 0 0"/>
    <!-- <joint name="box_base:joint" type="free" damping="0.01"/> -->

    <body name="box_lid" pos="0.007 0.0 0.1258">
      <geom name="box_lid:mesh" type="mesh" contype="0" conaffinity="0" rgba="0.87 0.72 0.52 1" mesh="box_lid"/>
      <geom name="box_lid:b1" type="box"
        contype="1" conaffinity="1"
        size="0.0635 0.037 0.002381" pos="0.0635 0.037 0.002381" rgba="0 0 0 0"/>
      <geom name="box_lid:b2" type="box"
        contype="1" conaffinity="1"
        size="0.02 0.0297 0.002381" pos="0.02 0.1036 0.002381" rgba="0 0 0 0"/>
      <geom name="box_lid:b3" type="box"
        contype="1" conaffinity="1"
        size="0.02 0.0297 0.002381" pos="0.107 0.1036 0.002381" rgba="0 0 0 0"/>
      <geom name="box_lid:b4" type="box"
        contype="1" conaffinity="1"
        size="0.0635 0.0079 0.002381" pos="0.0635 0.1254 0.002381" rgba="0 0 0 0"/>
      <geom name="box_lid:b5" type="box"
        contype="1" conaffinity="1"
        size="0.015 0.025 0.002381" pos="0.036 0.1036 0.002381" euler="0 0 -0.523" rgba="0 0 0 0"/>
      <geom name="box_lid:b6" type="box"
        contype="1" conaffinity="1"
        size="0.015 0.025 0.002381" pos="0.091 0.1036 0.002381" euler="0 0 0.523" rgba="0 0 0 0"/>
      <joint name="box_lid:joint" type="slide" axis="0 1 0"
        limited="true" range="-0.12 0" damping="0.8"/>
    </body>
  </body>
</mujoco>
