<mujoco model="master_7dof">
  <compiler angle="radian" coordinate="local"/>
  <option timestep="0.001" gravity="0 0 -9.81"/>

  <asset>
    <texture type="skybox" builtin="gradient"
             rgb1="1 1 1" rgb2=".6 .8 1"
             width="256" height="256"/>
  </asset>

  <default>
    <joint type="hinge" limited="true" damping="0.2"/>
    <geom contype="0" conaffinity="0" density="1000"/>
  </default>

  <worldbody>
    <body name="master_base" pos="0 0 0">
      <inertial pos="0 0 0" mass="1.0" diaginertia="1e-2 1e-2 1e-2"/>

      <body name="master_shoulder" pos="0 0 0">
        <inertial pos="0 0 0" mass="0.1" diaginertia="1e-4 1e-4 1e-4"/>

        <body name="master_link_sp" pos="0 0 0">
          <inertial pos="0 0 0" mass="0.1" diaginertia="1e-4 1e-4 1e-4"/>
          <joint name="master_shoulder_pitch_joint" axis="0 1 0" range="-3.1416 3.1416"/>

          <body name="master_link_sy" pos="0 0 0">
            <inertial pos="0 0 0" mass="0.1" diaginertia="1e-4 1e-4 1e-4"/>
            <joint name="master_shoulder_yaw_joint" axis="0 0 1" range="-3.1416 3.1416"/>

            <body name="master_upper_arm" pos="0 0 0">
              <inertial pos="0 0 0" mass="1.0" diaginertia="0.01 0.01 0.01"/>
              <joint name="master_shoulder_roll_joint" axis="1 0 0" range="-3.1416 3.1416"/>

              <geom name="geom_upper_arm" type="capsule" size="0.02"
                    fromto="0 0 0  0.280 0 0"/>

              <body name="master_forearm" pos="0.280 0 0">
                <inertial pos="0 0 0" mass="0.8" diaginertia="0.008 0.008 0.008"/>
                <joint name="master_elbow_flex_joint" axis="0 1 0" range="-3.1416 3.1416"/>

                <geom name="geom_forearm" type="capsule" size="0.018"
                      fromto="0 0 0  0.300 0 0"/>

                <body name="master_wrist" pos="0.300 0 0">
                  <inertial pos="0 0 0" mass="0.1" diaginertia="1e-4 1e-4 1e-4"/>

                  <body name="master_link_wr" pos="0 0 0">
                    <inertial pos="0 0 0" mass="0.1" diaginertia="1e-4 1e-4 1e-4"/>
                    <joint name="master_wrist_roll_joint" axis="1 0 0" range="-3.1416 3.1416"/>

                    <body name="master_link_wy" pos="0 0 0">
                      <inertial pos="0 0 0" mass="0.1" diaginertia="1e-4 1e-4 1e-4"/>
                      <joint name="master_wrist_yaw_joint" axis="0 1 0" range="-3.1416 3.1416"/>

                      <body name="master_ee" pos="0 0 0">
                        <inertial pos="0 0 0" mass="0.2" diaginertia="0.001 0.001 0.001"/>
                        <joint name="master_wrist_pitch_joint" axis="0 0 1" range="-3.1416 3.1416"/>

                        <geom name="geom_ee" type="box" pos="0.05 0 0"
                              size="0.05 0.01 0.01"/>
                      </body>
                    </body>
                  </body>
                </body>
              </body>
            </body>
          </body>
        </body>
      </body>
    </body>
  </worldbody>

  <actuator>
    <position name="act_sh_yaw"   joint="master_shoulder_pitch_joint" kp="200" ctrlrange="-3.14 3.14" forcerange="-50 50"/>
    <position name="act_sh_pitch" joint="master_shoulder_yaw_joint"   kp="200" ctrlrange="-3.14 3.14" forcerange="-50 50"/>

    <position name="act_sh_roll"  joint="master_shoulder_roll_joint"  kp="200" ctrlrange="-3.14 3.14" forcerange="-50 50"/>
    <position name="act_elbow"    joint="master_elbow_flex_joint"     kp="200" ctrlrange="-3.14 3.14" forcerange="-50 50"/>
    <position name="act_wr_roll"  joint="master_wrist_roll_joint"     kp="200" ctrlrange="-3.14 3.14" forcerange="-50 50"/>
    <position name="act_wr_yaw"   joint="master_wrist_yaw_joint"      kp="200" ctrlrange="-3.14 3.14" forcerange="-50 50"/>
    <position name="act_wr_pitch" joint="master_wrist_pitch_joint"    kp="200" ctrlrange="-3.14 3.14" forcerange="-50 50"/>
  </actuator>
</mujoco>