<!--
 Copyright (c) 2020, Fabio Muratore, Honda Research Institute Europe GmbH, and
 Technical University of Darmstadt.
 All rights reserved.

 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
 1. Redistributions of source code must retain the above copyright
    notice, this list of conditions and the following disclaimer.
 2. 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.
 3. Neither the name of Fabio Muratore, Honda Research Institute Europe GmbH,
    or Technical University of Darmstadt, 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 FABIO MURATORE, HONDA RESEARCH INSTITUTE EUROPE GMBH,
 OR TECHNICAL UNIVERSITY OF DARMSTADT 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.
-->

<mujoco model="furuta pendulum">
    <compiler texturedir="[ASSETS_DIR]/textures"/>
    <option gravity="0 0 -[gravity_const]" integrator="RK4" timestep="0.0005"/>
    <size nstack="10000"/>
    <default>
        <geom contype="0"/>
    </default>
    <visual>
    </visual>
    <visual>
        <rgba fog="1 1 1 1"/>
        <map znear="0.02" fogstart="1" fogend="3"/>
        <quality shadowsize="4096"/>
    </visual>
    <asset>
        <texture name="floor" type="2d" file="IAS_floor_fine.png"/>
        <texture name="qube" file="qqube.png" gridsize="3 4" gridlayout=".U..BFRL.D.."/>
        <material name="floor" rgba="0.8 0.9 0.8 1" reflectance="0.1" texture="floor" texrepeat="10 10"/>
        <material name="qube" reflectance="0.7" texture="qube"/>
        <material name="link" rgba="0.75 0.75 0.75 1" reflectance="0.9"/>
        <material name="pole" rgba="1 0 0 1" reflectance="0.9"/>
        <material name="foot" rgba="0 0 0 1" reflectance="0"/>
    </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 name="ground" type="plane" pos="0 0 0" size="10 10 0.1" material="floor"/>
        <geom name="cube" type="box" size="0.055 0.055 0.055" pos="0 0 0.06" euler="90 90 0" material="qube"/>
        <geom name="upLink" type="cylinder" fromto="0 0 0.12 0 0 0.13" size="0.003" material="link" mass="0"/>
        <geom name="mount" type="cylinder" fromto="0 0 0.115 0 0 0.122" size="0.012" material="qube" mass="0"/>
        <geom type="sphere" pos="-0.0475 -0.0475 0.005" size="0.005" material="foot" mass="0"/>
        <geom type="sphere" pos="+0.0475 -0.0475 0.005" size="0.005" material="foot" mass="0"/>
        <geom type="sphere" pos="-0.0475 +0.0475 0.005" size="0.005" material="foot" mass="0"/>
        <geom type="sphere" pos="+0.0475 +0.0475 0.005" size="0.005" material="foot" mass="0"/>
        <body>
            <joint name="theta" type="hinge" pos="0 0 0.13" axis="0 0 1" damping="[damping_rot_pole]" frictionloss="0"/>
            <geom name="rotaryArm" type="cylinder" fromto="0 0 0.13 [length_rot_pole] 0 0.13" size="0.003" material="link" mass="[mass_rot_pole]"/>
            <geom name="rotaryArmExtension" type="cylinder" fromto="[length_rot_pole] 0 0.13 [0.0055+length_rot_pole] 0 0.13" size="0.003" material="link" mass="0"/>
            <geom name="sensor" type="cylinder" fromto="-0.013 0 0.13 0.013 0 0.13" size="0.0065" material="link" mass="0"/>
            <body>
                <joint name="alpha" type="hinge" pos="[length_rot_pole] 0 0.13" axis="1 0 0" damping="[damping_pend_pole]" frictionloss="0"/>
                <geom name="pole" type="capsule" fromto="[length_rot_pole] 0 0.13 [length_rot_pole] 0 [0.13-length_pend_pole]" size="0.004" material="pole" mass="[mass_pend_pole]"/>
                <geom name="poleExtension" type="cylinder" fromto="[length_rot_pole] 0 0.13 [length_rot_pole] 0 0.135" size="0.004" material="pole" mass="0"/>
            </body>
        </body>
    </worldbody>
    <actuator>
        <motor name="motor" joint="theta"/>
    </actuator>
</mujoco>
