<!--
Quadcopter with x configuration.
Front: Along body X-axis
-->

<mujoco model="quadrotor_x">
    <compiler angle="degree" inertiafromgeom="true" coordinate="local"/>
    <option	timestep="0.01" gravity="0 0 -9.81" density="1" viscosity="1e-5" integrator="RK4"/>

    <default>
        <joint armature="1" damping="1" limited="true"/>
        <geom conaffinity="0" condim="3" density="5.0" friction="1 0.5 0.5" margin="0.01" rgba="0.8 0.6 0.4 1"/>
    </default>

    <asset>
        <texture builtin="gradient" type="skybox" height="100" width="100" rgb1="1 1 1" rgb2="0 0 0"/>
        <texture name="texgeom" builtin="flat" height="1278" mark="cross" markrgb="1 1 1" random="0.01" rgb1="0.8 0.6 0.4" rgb2="0.8 0.6 0.4" type="cube" width="127"/>
        <texture name="texplane" builtin="checker" height="100" width="100" rgb1="0 0 0" rgb2="0.8 0.8 0.8" type="2d"/>
        <material name="MatPlane" reflectance="0.5" shininess="1" specular="1" texrepeat="60 60" texture="texplane"/>
        <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.4 0.3 0.3 1" size="5 5 0.2" type="plane"/>

        <body name="core" pos="0 0 3.0">
            <joint name="root" type="free" damping="0" armature="0" pos="0 0 0" limited="false"/>
            <camera name="track" mode="trackcom" pos="0 -3 1.0" xyaxes="1 0 0 0 0 1"/>

            <geom name="core_geom" type="box" pos="0 0 0" quat="1 0 0 0" size=".04 .04 .02" rgba=".3 .3 .8 1" mass=".1"/>

            <geom name="arm_front_left" type="box" pos=".07 .07 0" size=".05 .005 .005" quat=".924 0 0 .383" rgba=".3 .3 .8 1" mass=".025"/>
            <geom name="arm_front_right" type="box" pos=".07 -.07 0" size=".05 .005 .005" quat=".383 0 0 .924" rgba=".3 .3 .8 1" mass=".025"/>
            <geom name="arm_back_right" type="box" pos="-.07 -.07 0" size=".05 .005 .005" quat="-.383 0 0 .924" rgba=".3 .3 .8 1" mass=".025"/>
            <geom name="arm_back_left" type="box" pos="-.07 .07 0" size=".05 .005 .005" quat=".924 0 0 -.383" rgba=".3 .3 .8 1" mass=".025"/>

            <site name="motor_front_left" type="cylinder" pos=".1 .1 .0075" size=".01 .0025" quat="1 0 0 0" rgba=".3 .8 .3 1"/>
            <site name="motor_front_right" type="cylinder" pos=".1 -.1 .0075" size=".01 .0025" quat="1 0 0 0" rgba=".3 .8 .3 1"/>
            <site name="motor_back_right" type="cylinder" pos="-.1 -.1 .0075" size=".01 .0025" quat="1 0 0 0" rgba=".3 .8 .3 1"/>
            <site name="motor_back_left" type="cylinder" pos="-.1  .1 .0075" size=".01 .0025" quat="1 0 0 0" rgba=".3 .8 .3 1"/>

            <geom name="thruster_front_left" type="cylinder" pos=".1 .1 .0075" size=".05 .0025" quat="1 0 0 0" rgba=".3 .8 .3 0.6" mass=".025"/>
            <geom name="thruster_front_right" type="cylinder" pos=".1 -.1 .0075" size=".05 .0025" quat="1 0 0 0" rgba=".3 .8 .3 0.6" mass=".025"/>
            <geom name="thruster_back_right" type="cylinder" pos="-.1 -.1 .0075" size=".05 .0025" quat="1 0 0 0" rgba=".3 .8 .3 0.6" mass=".025"/>
            <geom name="thruster_back_left" type="cylinder" pos="-.1 .1 .0075" size=".05 .0025" quat="1 0 0 0" rgba=".3 .8 .3 0.6" mass=".025"/>

            <site name="x_axis" type="box" pos=".1 0 0" size=".1 .005 .005" quat="1 0 0 0" rgba="1 0 0 0.3"/>
            <site name="y_axis" type="box" pos="0 .1 0" size=".1 .005 .005" quat=".707 0 0 .707" rgba="0 1 0 0.3"/>
            <site name="z_axis" type="box" pos="0 0 .1" size=".1 .005 .005" quat="-.707 0 .707 0" rgba="0 0 1 0.3"/>

        </body>
    </worldbody>

    <actuator>
        <motor ctrllimited="true" ctrlrange="0 1" gear="0 0 1 0 0 -.1" site="motor_front_left"/>
        <motor ctrllimited="true" ctrlrange="0 1" gear="0 0 1 0 0 .1" site="motor_back_left"/>
        <motor ctrllimited="true" ctrlrange="0 1" gear="0 0 1 0 0 -.1" site="motor_back_right"/>
        <motor ctrllimited="true" ctrlrange="0 1" gear="0 0 1 0 0 .1" site="motor_front_right"/>
    </actuator>

</mujoco>
