<!-- WorldLoop demo world: putting an earphone in its charger, in the living room.
     Sample scene for the upload workflow demo, step 13. Built offline and
     verified to load in MuJoCo 4.0.1. It is a sample, not a world built from
     a real upload: the table, charger dock, earphone, and arm are simple
     shapes with real sizes in meters. A real pack builds this from a scan. -->
<mujoco model="earphone-charger-living-room">
  <compiler angle="radian" inertiafromgeom="true" />
  <option timestep="0.002" gravity="0 0 -9.81" />

  <visual>
    <global offwidth="1280" offheight="800" />
    <headlight ambient="0.3 0.3 0.3" diffuse="0.8 0.8 0.8" />
  </visual>

  <asset>
    <texture name="grid" type="2d" builtin="checker" width="512" height="512"
             rgb1="0.92 0.92 0.92" rgb2="0.78 0.78 0.78" />
    <material name="floor_mat" texture="grid" texrepeat="4 4" />
    <material name="wood" rgba="0.55 0.38 0.22 1" />
    <material name="white" rgba="0.95 0.95 0.95 1" />
    <material name="dark" rgba="0.15 0.15 0.18 1" />
    <material name="blue" rgba="0.12 0.29 0.85 1" />
    <material name="metal" rgba="0.6 0.62 0.65 1" />
  </asset>

  <worldbody>
    <light name="key" pos="1.5 1 2" dir="-0.5 -0.3 -1"
           diffuse="0.9 0.9 0.9" specular="0.3 0.3 0.3" />
    <!-- Fill from the camera side, so the earphone's front face reads white
         instead of falling into the key light's shade. Gentle: it lifts the
         shaded faces without flattening the scene. -->
    <light name="fill" pos="0.3 -1.5 1.5" dir="0 0.8 -0.5"
           diffuse="0.75 0.75 0.75" specular="0.1 0.1 0.1" />
    <geom name="floor" type="plane" size="3 3 0.1" material="floor_mat" />
    <camera name="overview" pos="1.6 -1.5 1.5" zaxis="0.55 -0.75 0.37" />

    <!-- Living room table: top 1.2 m by 0.8 m, surface at 0.78 m. -->
    <body name="table" pos="0.5 0 0">
      <geom name="table_top" type="box" size="0.6 0.4 0.03" pos="0 0 0.75" material="wood" />
      <geom name="leg_fl" type="box" size="0.03 0.03 0.375" pos="-0.55 -0.35 0.375" material="wood" />
      <geom name="leg_fr" type="box" size="0.03 0.03 0.375" pos="0.55 -0.35 0.375" material="wood" />
      <geom name="leg_bl" type="box" size="0.03 0.03 0.375" pos="-0.55 0.35 0.375" material="wood" />
      <geom name="leg_br" type="box" size="0.03 0.03 0.375" pos="0.55 0.35 0.375" material="wood" />
    </body>

    <!-- Charger dock on the table: 12 cm by 8 cm, with a slot for the earphone. -->
    <body name="charger" pos="0.62 0.08 0.78">
      <geom name="dock" type="box" size="0.06 0.04 0.012" pos="0 0 0.012" material="white" />
      <geom name="slot" type="box" size="0.045 0.025 0.004" pos="0 0 0.026" material="dark" />
      <site name="dock_target" pos="0 0 0.028" size="0.01" />
    </body>

    <!-- The earphone, free to be grasped. Starts on the table left of the dock.
         A wireless earbud: a rounded bud head on a small flat base (so it
         rests flat on the table), a dark speaker mesh dot on its front face,
         and a stem that tapers toward the tip and leans 20 degrees, like a
         real earbud. About 31 mm tall, bud about 16 mm wide. The tip site
         stays at the bud centre, exactly where the judge measures it. -->
    <body name="earphone" pos="0.35 -0.1 0.792">
      <joint name="earphone_free" type="free" />
      <geom name="bud_base" type="cylinder" size="0.0055 0.0015" pos="0 0 0.0015" material="white" />
      <geom name="bud" type="sphere" size="0.0075" pos="0 0 0.0075" material="white" />
      <geom name="mesh" type="sphere" size="0.0018" pos="0 -0.0068 0.008" material="dark" />
      <geom name="stem_lower" type="cylinder" size="0.0045 0.006" pos="0.00405 0 0.01564" euler="0 0.3491 0" material="white" />
      <geom name="stem_upper" type="cylinder" size="0.0035 0.0045" pos="0.00696 0 0.02363" euler="0 0.3491 0" material="white" />
      <geom name="stem_tip" type="sphere" size="0.0035" pos="0.0085 0 0.02786" material="white" />
      <!-- The tip site stays at exactly (0, 0, 0.008), where the judge
           measures it. Its rendered size is small (0.002) so it does not
           show: at the old size 0.008 the renderer drew it as a 16 mm grey
           ball that swallowed the 15 mm bud and hid the white earphone. -->
      <site name="earphone_tip" pos="0 0 0.008" size="0.002" />
    </body>

    <!-- Simple 3-joint robot arm on the table, with a two-finger gripper. -->
    <body name="arm_base" pos="0.5 -0.35 0.78">
      <geom name="base" type="cylinder" size="0.05 0.02" pos="0 0 0.02" material="metal" />
      <body name="shoulder" pos="0 0 0.05">
        <joint name="shoulder_yaw" type="hinge" axis="0 0 1" range="-3.14 3.14" />
        <geom name="shoulder_body" type="cylinder" size="0.035 0.03" pos="0 0 0.03" material="dark" />
        <body name="upper_arm" pos="0 0 0.06">
          <joint name="shoulder_pitch" type="hinge" axis="0 1 0" range="-1.5 1.5" />
          <geom name="upper_link" type="capsule" size="0.025 0.11" pos="0 0 0.11" material="blue" />
          <body name="forearm" pos="0 0 0.22">
            <joint name="elbow" type="hinge" axis="0 1 0" range="-0.1 2.4" />
            <geom name="fore_link" type="capsule" size="0.02 0.09" pos="0 0 0.09" material="blue" />
            <body name="wrist" pos="0 0 0.18">
              <joint name="wrist_roll" type="hinge" axis="1 0 0" range="-1.5 1.5" />
              <geom name="wrist_body" type="sphere" size="0.025" pos="0 0 0.02" material="dark" />
              <body name="gripper" pos="0 0 0.04">
                <body name="finger_left_body" pos="0.032 0 0">
                  <joint name="finger_left_slide" type="slide" axis="1 0 0" range="-0.025 0.025" />
                  <geom name="finger_left" type="box" size="0.006 0.006 0.05" pos="0 0 0.03" material="metal" />
                </body>
                <body name="finger_right_body" pos="-0.032 0 0">
                  <joint name="finger_right_slide" type="slide" axis="1 0 0" range="-0.025 0.025" />
                  <geom name="finger_right" type="box" size="0.006 0.006 0.05" pos="0 0 0.03" material="metal" />
                </body>
                <site name="grip_point" pos="0 0 0.08" size="0.01" />
              </body>
            </body>
          </body>
        </body>
      </body>
    </body>
  </worldbody>

  <actuator>
    <motor name="m_shoulder_yaw" joint="shoulder_yaw" gear="1" />
    <motor name="m_shoulder_pitch" joint="shoulder_pitch" gear="1" />
    <motor name="m_elbow" joint="elbow" gear="1" />
    <motor name="m_wrist_roll" joint="wrist_roll" gear="1" />
    <motor name="m_finger_left" joint="finger_left_slide" gear="1" />
    <motor name="m_finger_right" joint="finger_right_slide" gear="1" />
  </actuator>

  <keyframe>
    <key name="home" qpos="0.35 -0.1 0.792 1 0 0 0 0 -0.5 1.1 0.3 0 0" />
  </keyframe>
</mujoco>
