<mujoco model="universal-robots-ur5e">
  <!-- robotparts universal-robots-ur5e: Universal Robots UR5e, the arm alone, in the part frame of its part.py
       frame_datum: UR's Base frame, the frame of UR's DH parameters (origin at the centre of the base mounting face,
       +Z along joint 1). Joint angles are UR's: all zero is UR's zero position.
       Made by BAM Robotics on 2026-11-23 with tools/measured/ur_arm_models.py (robotparts). Mesh-free: every geom is a
       capsule or cylinder, because robotparts/2 hosts a mesh only as a whole-part 3D model view (SCHEMA2.md §4); the
       placeable mesh of this arm is its own 3d-models view. Units: m, kg, rad.
       Sources, each cited beside its numbers:
         DH       = UR, 'DH Parameters for calculations of kinematics and dynamics', table 'UR5e/UR7e':
                    https://www.universal-robots.com/articles/ur/application-installation/dh-parameters-for-calculations-of-kinematics-and-dynamics/
         TORQUES  = UR, 'Max. joint torques CB3 and e-Series' (UR5/UR5e/UR7e column): https://www.universal-robots.com/articles/ur/robot-care-maintenance/max-joint-torques-cb3-and-e-series/
         SHEET    = https://www.universal-robots.com/manuals/EN/DataSheets/UR5e_techsheet_pdf_online/UR5e_techsheet_en.pdf
         ROS      = UR's ROS 2 description ur_description 4.4.0 (BSD-3-Clause), config/ur5e/:
                    https://github.com/UniversalRobots/Universal_Robots_ROS2_Description/tree/81f7c9fe003c2f0e02eec5a7253f1b262ad38b61
         MENAGERIE= MuJoCo Menagerie universal_robots_ur5e (BSD-3-Clause, Copyright 2018 ROS Industrial Consortium):
                    https://github.com/google-deepmind/mujoco_menagerie/tree/370c43965323c0944b433b202aac5058b5f907a9/universal_robots_ur5e
       Not UR's, and not identified on hardware: the armature, the actuator gains, the collision capsules and the
       base body's shape. UR publishes no rotor or gear inertia, friction, damping or servo gains.
       Licence BSD-3-Clause, as the Menagerie files it derives from:
       Copyright 2018 ROS Industrial Consortium (Menagerie universal_robots_ur5e); BAM Robotics' changes 2026.
       Redistribution and use in source and binary forms, with or without modification, are permitted provided that
       the following conditions are met:
         * Redistributions of source code must retain the above copyright notice, this list of conditions and the
           following disclaimer.
         * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
           following disclaimer in the documentation and/or other materials provided with the distribution.
         * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or
           promote products derived from this software without specific prior written permission.
       THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
       WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
       PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
       INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
       OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
       ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
       ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -->
  <compiler angle="radian" autolimits="true"/>
  <default>
    <default class="ur5e">
      <!-- every joint's range: SHEET datasheet p.1 Movement: every joint 'Working range ± 360°' (the user manual p.15 gives the Elbow ± 160°; UR's ROS 2 joint_limits.yaml ± 180°):
           ± 2π rad. armature 0.1 kg m^2: MENAGERIE's, not UR's (UR publishes no reflected inertia).
           -->
      <joint axis="0 1 0" range="-6.283185307179586 6.283185307179586" armature="0.1"/>
      <!-- position servos, ctrl in rad. Gains: MENAGERIE's, not UR's: gainprm 2000 and biasprm '0 -2000 -400' for
           size 3, 500 and '0 -500 -100' for size 1. Their velocity term is the joint's damping here, not the
           servo's: the robot profile allows no <option>, so MuJoCo's default Euler step applies, which treats
           joint damping implicitly but a servo's velocity term explicitly (Menagerie sets integrator
           implicitfast for that). Same force while the servo is under its forcerange; the damping is not
           clipped by it. forcerange: TORQUES, Size 3 = 150 Nm (Base, Shoulder, Elbow). -->
      <general gaintype="fixed" biastype="affine" ctrlrange="-6.283185307179586 6.283185307179586" gainprm="2000" biasprm="0 -2000 0" forcerange="-150 150"/>
      <geom type="capsule" rgba="0.82 0.82 0.82 1"/>
      <site size="0.001" rgba="0.5 0.5 0.5 0.3" group="4"/>
      <default class="size3">
        <joint damping="400"/>
      </default>
      <default class="size1">
        <!-- TORQUES: Size 1 = 28 Nm (Wrist 1, 2 and 3) -->
        <joint damping="100"/>
        <general gainprm="500" biasprm="0 -500 0" forcerange="-28 28"/>
      </default>
      <default class="eef">
        <geom type="cylinder"/>
      </default>
    </default>
  </default>
  <worldbody>
    <body name="base" childclass="ur5e">
      <!-- the base, fixed in the part frame: a cylinder of the footprint's radius, 0.0755 m (datasheet p.1 'Footprint Ø151 mm'),
           from the mounting face (z = 0) to z = 0.0991 m, the top of the base in the posed mesh (Menagerie's base_0.obj).
           mass 3 kg = SHEET datasheet p.1 'Weight including cable 20,7 kg' minus the six links of DH (17.7 kg): UR states
           no base mass, so the base carries the rest of the stated weight (base housing and cable). Fixed to the world,
           it moves nothing; it makes the model weigh what UR states. -->
      <geom name="base" type="cylinder" size="0.0755 0.04955" pos="0 0 0.04955" mass="3" rgba="0.278 0.278 0.278 1"/>
      <!-- shoulder_link: d1 = 0.1625 above the base (DH Joint 1); turned 180° about Z as MENAGERIE's base -->
      <body name="shoulder_link" pos="0 0 0.1625" quat="0 0 0 1">
        <!-- mass 3.761 kg: DH Link 1. Centre of mass: DH Link 1 [0, -0.02561, 0.00193] m in DH frame 1, here in this body's frame.
             Inertia about it: ROS physical_parameters.yaml tensor.shoulder (ixx 0.0070021, iyy 0.00648091, izz 0.00657286, ixy 7.3e-07, ixz -1.053e-05, iyz 0.00049994)
             in its frame rotated rpy (1.570796327, 0, 0) from ur_description's shoulder_link frame, here in this body's frame.
             DH gives 0 ('the inertia matrix values for UR3e and UR5e are negligible'). -->
        <inertial pos="0 0.00193 -0.02561" mass="3.761" fullinertia="0.0070021 0.00657286 0.00648091 1.053e-05 -7.3e-07 0.00049994"/>
        <!-- joint 1: DH Joint 1's axis (z of DH frame 0) -->
        <joint name="shoulder_pan_joint" class="size3" axis="0 0 1"/>
        <geom pos="0 0 -0.04" size="0.06 0.06"/>
        <!-- upper_arm_link: 0.138 along joint 2's axis: ROS visual_parameters.yaml upper_arm z (the shoulder offset; DH puts joint 2's frame on joint 1's axis, so it moves no point of the arm) -->
        <body name="upper_arm_link" pos="0 0.138 0" quat="1 0 1 0">
          <!-- mass 8.058 kg: DH Link 2. Centre of mass: DH Link 2 [0.2125, 0, 0.11336] m in DH frame 2, here in this body's frame.
               Inertia about it: ROS physical_parameters.yaml tensor.upper_arm (ixx 0.01505885, iyy 0.33388086, izz 0.33247207, ixy -5.4e-05, ixz 5.63e-06, iyz -1.81e-06)
               in its frame rotated rpy (0, 0, 0) from ur_description's upper_arm_link frame, here in this body's frame.
               DH gives 0 ('the inertia matrix values for UR3e and UR5e are negligible'). -->
          <inertial pos="0 -0.02464 0.2125" mass="8.058" fullinertia="0.33388086 0.33247207 0.01505885 1.81e-06 -5.4e-05 -5.63e-06"/>
          <!-- joint 2: DH Joint 2's axis (z of DH frame 1) -->
          <joint name="shoulder_lift_joint" class="size3" axis="0 1 0"/>
          <geom pos="0 -0.04 0" quat="1 1 0 0" size="0.06 0.06"/>
          <geom pos="0 0 0.2" size="0.05 0.2"/>
          <!-- forearm_link: -a2 = 0.425 along the upper arm (DH Joint 2), and -0.131 back along the elbow's axis: ROS visual_parameters.yaml upper_arm z - forearm z = 0.138 - 0.007 -->
          <body name="forearm_link" pos="0 -0.131 0.425">
            <!-- mass 2.846 kg: DH Link 3. Centre of mass: DH Link 3 [0.15, 0, 0.0265] m in DH frame 3, here in this body's frame.
                 Inertia about it: ROS physical_parameters.yaml tensor.forearm (ixx 0.00399632, iyy 0.07879254, izz 0.0784851, ixy -1.365e-05, ixz 0.00137272, iyz -6.6e-06)
                 in its frame rotated rpy (0, 0, 0) from ur_description's forearm_link frame, here in this body's frame.
                 DH gives 0 ('the inertia matrix values for UR3e and UR5e are negligible'). -->
            <inertial pos="0 0.0195 0.2422" mass="2.846" fullinertia="0.07879254 0.0784851 0.00399632 6.6e-06 -1.365e-05 -0.00137272"/>
            <!-- joint 3: DH Joint 3's axis (z of DH frame 2) -->
            <joint name="elbow_joint" class="size3" axis="0 1 0"/>
            <geom pos="0 0.08 0" quat="1 1 0 0" size="0.055 0.06"/>
            <geom pos="0 0 0.2" size="0.038 0.19"/>
            <!-- wrist_1_link: -a3 = 0.3922 along the forearm (DH Joint 3) -->
            <body name="wrist_1_link" pos="0 0 0.3922" quat="1 0 1 0">
              <!-- mass 1.37 kg: DH Link 4. Centre of mass: DH Link 4 [0, -0.0018, 0.01634] m in DH frame 4, here in this body's frame.
                   Inertia about it: ROS physical_parameters.yaml tensor.wrist_1 (ixx 0.00165491, iyy 0.00135962, izz 0.00126279, ixy -2.82e-06, ixz -4.38e-06, iyz 0.00010157)
                   in its frame rotated rpy (1.570796327, 0, 0) from ur_description's wrist_1_link frame, here in this body's frame.
                   DH gives 0 ('the inertia matrix values for UR3e and UR5e are negligible'). -->
              <inertial pos="0 0.1245 0.01634" mass="1.37" fullinertia="0.00165491 0.00135962 0.00126279 -2.82e-06 -4.38e-06 0.00010157"/>
              <!-- joint 4: DH Joint 4's axis (z of DH frame 3) -->
              <joint name="wrist_1_joint" class="size1" axis="0 1 0"/>
              <geom pos="0 0.05 0" quat="1 1 0 0" size="0.04 0.07"/>
              <!-- wrist_2_link: d4 = 0.1333 (DH Joint 4) less the 0.007 already taken along the shoulder and elbow axes -->
              <body name="wrist_2_link" pos="0 0.1263 0">
                <!-- mass 1.3 kg: DH Link 5. Centre of mass: DH Link 5 [0, 0.0018, 0.01634] m in DH frame 5, here in this body's frame.
                     Inertia about it: ROS physical_parameters.yaml tensor.wrist_2 (ixx 0.00135617, iyy 0.00127827, izz 0.00096614, ixy -2.74e-06, ixz 4.44e-06, iyz -5.048e-05)
                     in its frame rotated rpy (-1.570796327, 0, 0) from ur_description's wrist_2_link frame, here in this body's frame.
                     DH gives 0 ('the inertia matrix values for UR3e and UR5e are negligible'). -->
                <inertial pos="0 0.01634 0.0979" mass="1.3" fullinertia="0.00135617 0.00096614 0.00127827 4.44e-06 2.74e-06 5.048e-05"/>
                <!-- joint 5: DH Joint 5's axis (z of DH frame 4) -->
                <joint name="wrist_2_joint" class="size1" axis="0 0 1"/>
                <geom pos="0 0 0.04" size="0.04 0.06"/>
                <geom pos="0 0.02 0.1" quat="1 1 0 0" size="0.04 0.04"/>
                <!-- wrist_3_link: d5 = 0.0997 (DH Joint 5) -->
                <body name="wrist_3_link" pos="0 0 0.0997">
                  <!-- mass 0.365 kg: DH Link 6. Centre of mass: DH Link 6 [0, 0, -0.001159] m in DH frame 6, here in this body's frame.
                       Inertia about it: ROS physical_parameters.yaml tensor.wrist_3 (ixx 0.00018694, iyy 0.00018908, izz 0.00025756, ixy 6e-08, ixz -1.7e-07, iyz -9.2e-07)
                       in its frame rotated rpy (0, 0, 0) from ur_description's wrist_3_link frame, here in this body's frame.
                       DH gives Link 6 the inertia [0, 0, 0, 0, 0, 0, 0, 0, 0.0002] and calls the UR5e's 'negligible';
                       a tensor with zero Ixx and Iyy is not physical, so ROS's is used. -->
                  <inertial pos="0 0.098441 0" mass="0.365" fullinertia="0.00018694 0.00025756 0.00018908 -1.7e-07 -6e-08 9.2e-07"/>
                  <!-- joint 6: DH Joint 6's axis (z of DH frame 5) -->
                  <joint name="wrist_3_joint" class="size1" axis="0 1 0"/>
                  <geom class="eef" pos="0 0.08 0" quat="1 1 0 0" size="0.04 0.02"/>
                  <!-- the tool flange's centre: d6 = 0.0996 along joint 6 (DH Joint 6), the origin of DH frame 6. Oriented as MENAGERIE's attachment_site, where a tool mounts. -->
                  <site name="attachment_site" pos="0 0.0996 0" quat="-1 1 0 0"/>
                </body>
              </body>
            </body>
          </body>
        </body>
      </body>
    </body>
  </worldbody>
  <contact>
    <!-- the base is welded to the world, so MuJoCo's parent-child filter does not cover it and the shoulder
         capsule, which reaches into the base, would touch it at every pose -->
    <exclude body1="base" body2="shoulder_link"/>
  </contact>
  <actuator>
    <general class="size3" name="shoulder_pan" joint="shoulder_pan_joint"/>
    <general class="size3" name="shoulder_lift" joint="shoulder_lift_joint"/>
    <general class="size3" name="elbow" joint="elbow_joint"/>
    <general class="size1" name="wrist_1" joint="wrist_1_joint"/>
    <general class="size1" name="wrist_2" joint="wrist_2_joint"/>
    <general class="size1" name="wrist_3" joint="wrist_3_joint"/>
  </actuator>
  <keyframe>
    <!-- MENAGERIE's home: the arm upright, the tool pointing down -->
    <key name="home" qpos="-1.5708 -1.5708 1.5708 -1.5708 -1.5708 0" ctrl="-1.5708 -1.5708 1.5708 -1.5708 -1.5708 0"/>
  </keyframe>
</mujoco>
