<?xml version="1.0" encoding="utf-8"?>
<robot name="cartpole">

  <!-- World link (fixed base) -->
  <link name="world"/>

  <!-- Cart (slides along x-axis) -->
  <link name="cart">
    <inertial>
      <mass value="1.0"/>
      <inertia ixx="0.001" ixy="0" ixz="0" iyy="0.001" iyz="0" izz="0.001"/>
    </inertial>
    <visual>
      <geometry>
        <box size="0.3 0.2 0.1"/>
      </geometry>
    </visual>
    <collision>
      <geometry>
        <box size="0.3 0.2 0.1"/>
      </geometry>
    </collision>
  </link>

  <!-- Cart slides along x-axis -->
  <joint name="cart_joint" type="prismatic">
    <parent link="world"/>
    <child link="cart"/>
    <axis xyz="1 0 0"/>
    <limit lower="-2.4" upper="2.4" effort="100" velocity="10"/>
  </joint>

  <!-- Pole (rotates around y-axis, attached on top of cart) -->
  <link name="pole">
    <inertial>
      <origin xyz="0 0 0.3"/>
      <mass value="0.1"/>
      <inertia ixx="0.003" ixy="0" ixz="0" iyy="0.003" iyz="0" izz="0.0001"/>
    </inertial>
    <visual>
      <origin xyz="0 0 0.3"/>
      <geometry>
        <cylinder radius="0.02" length="0.6"/>
      </geometry>
    </visual>
    <collision>
      <origin xyz="0 0 0.3"/>
      <geometry>
        <cylinder radius="0.02" length="0.6"/>
      </geometry>
    </collision>
  </link>

  <!-- Pole rotates freely (no motor) -->
  <joint name="pole_joint" type="revolute">
    <parent link="cart"/>
    <child link="pole"/>
    <origin xyz="0 0 0.05"/>
    <axis xyz="0 1 0"/>
    <limit lower="-6.28" upper="6.28" effort="0" velocity="100"/>
    <dynamics damping="0.0" friction="0.0"/>
  </joint>

</robot>