
<mujoco model="inverted_pendulum">
  <compiler angle="radian" coordinate="local" inertiafromgeom="true"/>

  <default>
    <joint armature=".1" damping=".01" limited="true" solimplimit="0 .8 .03" solreflimit=".02 1" />
    <geom conaffinity="0" condim="3" contype="1" friction=".4 .1 .1" rgba="0.8 0.6 .4 1" solimp="0.0 0.8 0.01" solref="0.02 1"/>
    <motor ctrllimited="true" ctrlrange="-4.2 4.2"/>
  </default>

  <size nstack="300000" nuser_geom="1"/>
  <option gravity="0 0 -9.81" timestep="0.01"/>

  <asset>
    <texture builtin="gradient" height="100" rgb1="1 1 1" rgb2="0 0 0" type="skybox" width="100"/>
    <texture builtin="flat" height="1278" mark="cross" markrgb="1 1 1" name="texgeom" random="0.01" rgb1="0.8 0.6 0.4" rgb2="0.8 0.6 0.4" type="cube" width="127"/>
    <texture builtin="checker" height="100" name="texplane" rgb1="0 0 0" rgb2="0.8 0.8 0.8" type="2d" width="100"/>
    <material name="MatPlane" reflectance="0." shininess="0" specular="0" texrepeat="60 60" texture="texplane"/>
      <material name="metal" reflectance="0.5" shininess="0.5" specular="0.5" />

    <material name="geom" texture="texgeom" texuniform="true"/>
  </asset>

  <worldbody>
    <light cutoff="100" diffuse="1 1 1" dir="-0 0 -1.3" directional="true" exponent="1" pos="0 0 1.3" specular=".1 .1 .1"/>
    <geom conaffinity="1" condim="3" material="MatPlane" name="floor" pos="0 0 0" rgba="0.6 0.8 0.6 1" size="40 40 40" type="plane"/>

    <!-- ------Inverted Pendulem------>  <!--body express -->
    <body name="base" pos="0 0 0.5" mocap="true">
      <camera name="track" mode="trackcom" pos="0 -3 0.3" xyaxes="1 0 0 0 0 1"/>
      <geom type="box" pos="0 0 0" size="5 5 0.5" name="base" mass="5" rgba="0.2 0.2 0.2 1"  material="metal"/>
      <!-- <site name='tip'  pos='.15 0 .11'/>-->
        <body name="support" pos="0 0 6">
            <geom axisangle="0 0 1 -.27" name="support" pos="0 0 0" rgba="0.4 0.4 0.4 1" size=".4 6" type="capsule" mass="5" material="metal"/>
            <body name="motor" pos="0 0 6.3">
                <joint axis="0 0 1"  name="motor" pos="0 0 0" range="-3.14159265359 3.14159265359" type="hinge" limited="false"/>
                <geom axisangle="0 0 1 0" name="motor" pos="0 0 0" rgba="0.6 0.6 0.6 1" size=".4 0.3" type="capsule" mass="0.5" material="metal"/>
                <site name="motor" pos="0 0 0" size=".3 .3 .3" type="ellipsoid" rgba="0.3 0.2 0.1 0.3"/>
                <body name="arm" pos="4.5 0 0.2">
                    <geom type="box" pos="0 0 0" size="5 0.2 0.2" name="arm" mass="0.1" material="metal"/>
                    <body name="pole" pos="4.8 0 0">
                     <joint axis="1 0 0" damping="0.01" name="pole" pos="0 0 0" range="-6.28318530718 6.28318530718" type="hinge" frictionloss='0.' limited="false"/>
                     <!--<joint axis="1 0 0" damping="1.25" name="pole" pos="0 0 4" range="-6.28318530718 6.28318530718" type="hinge" frictionloss='0.' limited="false"/>-->
                     <!--<joint axis="1 0 0" damping=".01" name="pole" pos="0 0 4" range="-1.5707963267949 1.5707963267949" type="hinge" frictionloss='0.' />-->
                     <geom axisangle="1 0 0 0" name="pole" pos="0 0 4" size=".2 4" type="capsule" mass="0.05" />-->
                    </body>
                </body>
            </body>
        </body>
    </body>
  </worldbody>
  <actuator>
    <motor gear="4.2" joint="motor" name="motor" ctrllimited="true" ctrlrange="-1.0 1.0" />
  </actuator>
  <sensor>
    <torque site="motor" name="torque_sensor"/>
  </sensor>
</mujoco>
