<!-- Cartpole Model

    The state space is populated with joints in the order that they are
    defined in this file. The actuators also operate on joints.

    State-Space (name/joint/parameter):
        - cart      slider      position (m)
        - pole      hinge       angle (rad)
        - cart      slider      velocity (m/s)
        - pole      hinge       angular velocity (rad/s)

    Actuators (name/actuator/parameter):
        - cart      motor       force x (N)

-->
<mujoco model='cartpole'>
    <compiler inertiafromgeom='true'
              coordinate='local'/>

    <custom>
        <numeric name="frame_skip" data="2" />
    </custom>

    <default>
        <joint damping='0.05' />
        <geom contype='0'
              friction='1 0.1 0.1'
              rgba='0.7 0.7 0 1' />
    </default>

    <option timestep='0.01'
            gravity='1e-5 0 -9.81'
            integrator="RK4"
    />

    <size nstack='3000'/>

    <worldbody>
        <geom name='floor'
              pos='0 0 -3.0'
              size='40 40 40'
              type='plane'
              rgba='0.8 0.9 0.8 1' />
        <geom name='rail'
              type='capsule'
              pos='0 0 0'
              quat='0.707 0 0.707 0'
              size='0.02 1'
              rgba='0.3 0.3 0.7 1' />
        
        <body name='cart' pos='0 0 0'>
            <!-- <joint name='slider' -->
            <!--        type='slide' -->
            <!--        limited='true' -->
            <!--        pos='0 0 0' -->
            <!--        axis='1 0 0' -->
            <!--        range='-10 10' -->
            <!--        margin='0.01'/> -->
            <geom name='cart'
                  type='capsule'
                  pos='0 0 0'
                  quat='0.707 0 0.707 0'
                  size='0.1 0.1' />
            <body name='pole' pos='0 0 0'>
                <joint name='hinge'
                       type='hinge'
                       pos='0 0 0'
                       axis='0 1 0'/>
                <geom name='cpole'
                      type='capsule'
                      fromto='0 0 0 0 0 0.6'
                      size='0.045 0.3'
                      rgba='0 0.7 0.7 1' />
                <body name='pole2' pos='0 0 0.6'>
                    <joint name='hinge2'
                           type='hinge'
                           pos='0 0 0'
                           axis='0 1 0'/>
                    <site name='hinge2_site'
                          pos='0 0 0'/>
                    <geom name='cpole2'
                          type='capsule'
                          fromto='0 0 0 0 0 0.6'
                          size='0.045 0.3'
                          rgba='0 0.7 0.7 1' />
                    <site name='tip'
                          size='0.01 0.01'
                          pos='0 0 .6'/>
                </body>
            </body>
        </body>
    </worldbody>

    <actuator>
        <position name='a_hinge2'
               joint='hinge2'
               ctrlrange='-1 1'
               ctrllimited='true'/>
    </actuator>
</mujoco>





