<mujoco model="universal-robots-ur5-cb3">
  <!-- robotparts universal-robots-ur5-cb3: Universal Robots UR5 (CB3), 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 'UR5':
                    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/PDF/SW3_16/user-manual-UR5-PDF/UR5_User_Manual_en.pdf
         ROS      = UR's ROS 2 description ur_description 4.4.0 (BSD-3-Clause), config/ur5/:
                    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
         CAPSULES = the collision capsules of universal_robots_ur5 in MuJoCo Menagerie pull request #347
                    (not merged; BSD-3-Clause; same body frames as MENAGERIE):
                    https://github.com/HamidRobotics/mujoco_menagerie/tree/c4a862ed45c56de6cda71be136bc317fb2451389/universal_robots_ur5
       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 and MuJoCo Menagerie pull request #347's universal_robots_ur5 (its capsules, BSD-3-Clause):
       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="ur5-cb3">
      <!-- every joint's range: SHEET user manual UR5/CB3 p.90 'Joint ranges ± 360 ° for all joints':
           ± 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="ur5-cb3">
      <!-- the base, fixed in the part frame: a cylinder of the footprint's radius, 0.0745 m (user manual UR5/CB3 p.90 'Footprint Ø149 mm'),
           from the mounting face (z = 0) to z = 0.024 m, the top of the base in the posed mesh (ur_description's ur5 base.dae).
           mass 1.3511 kg = SHEET user manual UR5/CB3 p.90 'Weight 18.4 kg' minus the six links of DH (17.0489 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.0745 0.012" pos="0 0 0.012" mass="1.3511" rgba="0.278 0.278 0.278 1"/>
      <!-- shoulder_link: d1 = 0.089159 above the base (DH Joint 1); turned 180° about Z as MENAGERIE's base -->
      <body name="shoulder_link" pos="0 0 0.089159" quat="0 0 0 1">
        <!-- mass 3.7 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.01497235833, iyy 0.01497235833, izz 0.01040625, ixy 0, ixz 0, iyz 0)
             in its frame rotated rpy (0, 0, 0) from ur_description's shoulder_link frame, here in this body's frame.
             DH gives no inertia for the UR5; ROS's tensor is its 'cylinder approximation'. -->
        <inertial pos="0 0.00193 -0.02561" mass="3.7" fullinertia="0.01497235833 0.01497235833 0.01040625 0 0 0"/>
        <!-- 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.0165" size="0.0595 0.0222"/>
        <!-- upper_arm_link: 0.13585 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.13585 0" quat="1 0 1 0">
          <!-- mass 8.393 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.1338858354, iyy 0.1338858354, izz 0.0151074, ixy 0, ixz 0, iyz 0)
               in its frame rotated rpy (0, 1.570796327, 0) from ur_description's upper_arm_link frame, here in this body's frame.
               DH gives no inertia for the UR5; ROS's tensor is its 'cylinder approximation'. -->
          <inertial pos="0 -0.02249 0.2125" mass="8.393" fullinertia="0.1338858354 0.1338858354 0.0151074 0 0 0"/>
          <!-- 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.0634 0" quat="1 1 0 0" size="0.0595 0.102"/>
          <geom pos="0 0 0.212" size="0.0501 0.182"/>
          <!-- forearm_link: -a2 = 0.425 along the upper arm (DH Joint 2), and -0.11935 back along the elbow's axis: ROS visual_parameters.yaml upper_arm z - forearm z = 0.13585 - 0.0165 -->
          <body name="forearm_link" pos="0 -0.11935 0.425">
            <!-- mass 2.33 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.03121680352, iyy 0.03121680352, izz 0.004095, ixy 0, ixz 0, iyz 0)
                 in its frame rotated rpy (0, 1.570796327, 0) from ur_description's forearm_link frame, here in this body's frame.
                 DH gives no inertia for the UR5; ROS's tensor is its 'cylinder approximation'. -->
            <inertial pos="0 0.01 0.24225" mass="2.33" fullinertia="0.03121680352 0.03121680352 0.004095 0 0 0"/>
            <!-- 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.0759 0" quat="1 1 0 0" size="0.0595 0.0821"/>
            <geom pos="0 0 0.197" size="0.0375 0.173"/>
            <!-- wrist_1_link: -a3 = 0.39225 along the forearm (DH Joint 3) -->
            <body name="wrist_1_link" pos="0 0 0.39225" quat="1 0 1 0">
              <!-- mass 1.219 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.002013889583, iyy 0.002013889583, izz 0.0021942, ixy 0, ixz 0, iyz 0)
                   in its frame rotated rpy (0, 0, 0) from ur_description's wrist_1_link frame, here in this body's frame.
                   DH gives no inertia for the UR5; ROS's tensor is its 'cylinder approximation'. -->
              <inertial pos="0 0.09085 0.01634" mass="1.219" fullinertia="0.002013889583 0.0021942 0.002013889583 0 0 0"/>
              <!-- 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.0373 0" quat="1 1 0 0" size="0.0389 0.0751"/>
              <!-- wrist_2_link: d4 = 0.10915 (DH Joint 4) less the 0.0165 already taken along the shoulder and elbow axes -->
              <body name="wrist_2_link" pos="0 0.09265 0">
                <!-- mass 1.219 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.001831039583, iyy 0.001831039583, izz 0.0021942, ixy 0, ixz 0, iyz 0)
                     in its frame rotated rpy (0, 0, 0) from ur_description's wrist_2_link frame, here in this body's frame.
                     DH gives no inertia for the UR5; ROS's tensor is its 'cylinder approximation'. -->
                <inertial pos="0 0.01634 0.09285" mass="1.219" fullinertia="0.001831039583 0.001831039583 0.0021942 0 0 0"/>
                <!-- 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.0378" size="0.0389 0.0756"/>
                <geom pos="0 -0.00485 0.0946" quat="1 1 0 0" size="0.0391 0.0328"/>
                <!-- wrist_3_link: d5 = 0.09465 (DH Joint 5) -->
                <body name="wrist_3_link" pos="0 0 0.09465">
                  <!-- mass 0.1879 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 8.062475833e-05, iyy 8.062475833e-05, izz 0.0001321171875, ixy 0, ixz 0, iyz 0)
                       in its frame rotated rpy (0, 0, 0) from ur_description's wrist_3_link frame, here in this body's frame.
                       DH gives no inertia for the UR5; ROS's tensor is its 'cylinder approximation'. -->
                  <inertial pos="0 0.081141 0" mass="0.1879" fullinertia="8.0624758e-05 0.000132117187 8.0624758e-05 0 0 0"/>
                  <!-- 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.0651 0" quat="1 1 0 0" size="0.043 0.0172"/>
                  <!-- the tool flange's centre: d6 = 0.0823 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.0823 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>
