<?xml version="1.0"?>
<?xml-model href="https://raw.githubusercontent.com/ros/urdfdom/master/xsd/urdf.xsd" ?>
<robot name="BB25">

    <!-- The metal chassis, servos, and circuitry all combine to a single rigid body. This is
         the root link: the original file's "base" plate + a "6DoF" floating joint down to
         "chassis" were dropped (see gallery/sources/NOTES.md's "BB25" entry) — the same
         free-standing structure the robot's own working MJCF file already uses. -->
    <link name="chassis">
        <inertial>
            <origin xyz="-0.06 0 0.05"/>
            <mass value="1.0"/>
            <inertia ixx="0.0006528333333333334" ixy="0" ixz="0" iyy="0.0014283533333333334" iyz="0" izz="0.0019126466666666668"/>
        </inertial>
        <visual>
            <origin xyz="0 0 0"/>
            <geometry>
                <mesh filename="chassis.glb"/>
            </geometry>
        </visual>
        <!-- A box covering the core deck/body only, excluding the two side-mounted servo
             cases + horns — those protrude far enough toward the wheels that a box sized to
             the full mesh would intersect the wheel collision geometry below. Dimensions and
             origin computed from the actual chassis mesh with the two servo assemblies
             (S3006_S148_U301PAA, S3006_S148_U301PAA_001) excluded — see gallery/sources/
             NOTES.md's "BB25" entry. -->
        <collision>
            <origin xyz="-0.0667 0 0.0447"/>
            <geometry>
                <box size="0.1330 0.0826 0.0694"/>
            </geometry>
        </collision>
    </link>

    <!-- The differential drive wheels on the left and right side of the chassis. The local wheel axis is -Z. -->
    <link name="right_wheel">
        <inertial>
            <origin xyz="0 0 0"/>
            <mass value="0.1"/>
            <inertia ixx="0.0001" ixy="0" ixz="0" iyy="0.0001" iyz="0" izz="0.0001"/>
        </inertial>
        <visual>
            <origin xyz="0 0 0"/>
            <geometry>
                <mesh filename="wheel.glb"/>
            </geometry>
        </visual>
        <!-- Measured directly off wheel.stl: a 0.070 m diameter disc, 0.0087 m thick, already
             centered on the link origin — matches the mesh's own local frame with no offset. -->
        <collision>
            <origin xyz="0 0 0"/>
            <geometry>
                <cylinder radius="0.035" length="0.0087"/>
            </geometry>
        </collision>
    </link>
    <link name="left_wheel">
        <inertial>
            <origin xyz="0 0 0"/>
            <mass value="0.1"/>
            <inertia ixx="0.0001" ixy="0" ixz="0" iyy="0.0001" iyz="0" izz="0.0001"/>
        </inertial>
        <visual>
            <origin xyz="0 0 0"/>
            <geometry>
                <mesh filename="wheel.glb"/>
            </geometry>
        </visual>
        <collision>
            <origin xyz="0 0 0"/>
            <geometry>
                <cylinder radius="0.035" length="0.0087"/>
            </geometry>
        </collision>
    </link>

    <!-- The rear caster wheel that balances the robot -->
    <link name="rear_wheel">
        <inertial>
            <origin xyz="0 0 0"/>
            <mass value="0.1"/>
            <inertia ixx="0.0001" ixy="0" ixz="0" iyy="0.0001" iyz="0" izz="0.0001"/>
        </inertial>
        <visual>
            <origin xyz="0 0 0"/>
            <geometry>
                <mesh filename="rear_wheel.glb"/>
            </geometry>
        </visual>
        <collision>
            <origin xyz="0 0 0"/>
            <geometry>
                <sphere radius="0.0127"/>
            </geometry>
        </collision>
    </link>

    <!-- The right and left wheels can rotate about the Y-axis of the chassis, local Z-axis of the wheels -->
    <joint name="right" type="continuous">
        <parent link="chassis"/>
        <child link="right_wheel"/>
        <origin xyz="-0.04645 -0.0555 0.035" rpy="-1.570796327 0 0"/>
        <axis xyz="0 0 1"/>
    </joint>
    <joint name="left" type="continuous">
        <parent link="chassis"/>
        <child link="left_wheel"/>
        <origin xyz="-0.04645 0.0555 0.035" rpy="1.570796327 0 0"/>
        <axis xyz="0 0 1"/>
    </joint>

    <!-- The rear caster wheel can rotate freely about the Y-axis of the chassis — a passive
         mechanical DOF, not a driven one (see the transmissions below and the MJCF's own
         <actuator> block: neither actuates "rear"). -->
    <joint name="rear" type="continuous">
        <parent link="chassis" />
        <child link="rear_wheel" />
        <origin xyz="-0.130752 0 0.0127" />
        <axis xyz="0 1 0" />
    </joint>


    <transmission name="left_wheel_trans">
      <type>transmission_interface/SimpleTransmission</type>
      <joint name="left">
        <hardwareInterface>EffortJointInterface</hardwareInterface>
      </joint>
      <actuator name="left_wheel_motor">
        <hardwareInterface>EffortJointInterface</hardwareInterface>
        <mechanicalReduction>1</mechanicalReduction>
      </actuator>
    </transmission>

    <transmission name="right_wheel_trans">
      <type>transmission_interface/SimpleTransmission</type>
      <joint name="right">
        <hardwareInterface>EffortJointInterface</hardwareInterface>
      </joint>
      <actuator name="right_wheel_motor">
        <hardwareInterface>EffortJointInterface</hardwareInterface>
        <mechanicalReduction>1</mechanicalReduction>
      </actuator>
    </transmission>

</robot>
