<mujoco model="simple flying humanoid robot">
    <compiler angle="radian" />

    <option timestep="0.005" collision="predefined" gravity="0 0 0"/>

    <asset>
        <texture type="skybox" builtin="gradient" rgb1="0.6 0.6 0.6" rgb2="0 0 0" width="512" height="512"/>
        <texture name="texplane" type="2d" builtin="checker" rgb1=".25 .25 .25" rgb2=".3 .3 .3" width="512" height="512" mark="cross" markrgb=".8 .8 .8"/>
        <material name="matplane" reflectance="0.3" texture="texplane" texrepeat="1 1" texuniform="true"/>
    </asset>

    <worldbody>
        <!-- Floor & lights -->
        <geom name="floor" pos="0 0 -0.5" size="0 0 1" type="plane" material="matplane"/>
        <light directional="true" diffuse=".8 .8 .8" specular=".2 .2 .2" pos="0 0 5" dir="0 0 -1" castshadow="false"/>

        <!-- Environment -->
        <body name="rbar0" pos="1 1 0" >
            <geom name="rbar0" type="box" size="0.1 0.05 0.05" group="1" rgba="0.7 0.7 0.7 1" />
            <site name="rbar0_front" pos="0 0.05 0"  quat="0.707 0 0  0.707" type="sphere" size="1e-3" group="2" rgba="1 0 0 1" />
            <site name="rbar0_rear"  pos="0 -0.05 0" quat="0.707 0 0 -0.707" type="sphere" size="1e-3" group="2" rgba="1 0 0 1" />
        </body>
        <body name="lbar0" pos="-1 1 0" >
            <geom name="lbar0" type="box" size="0.1 0.05 0.05" group="1" rgba="0.7 0.7 0.7 1" />
            <site name="lbar0_front" pos="0 0.05 0" quat="0.707 0 0  0.707" type="sphere" size="1e-3" group="2" rgba="1 0 0 1" />
            <site name="lbar0_rear" pos="0 -0.05 0" quat="0.707 0 0 -0.707" type="sphere" size="1e-3" group="2" rgba="1 0 0 1" />
        </body>
        <body name="rbar1" pos="1 2 0" >
            <geom name="rbar1" type="box" size="0.1 0.05 0.05" group="1" rgba="0.7 0.7 0.7 1" />
            <site name="rbar1_front" pos="0 0.05 0" quat="0.707 0 0  0.707" type="sphere" size="1e-3" group="2" rgba="1 0 0 1" />
            <site name="rbar1_rear" pos="0 -0.05 0" quat="0.707 0 0 -0.707" type="sphere" size="1e-3" group="2" rgba="1 0 0 1" />
        </body>
        <body name="lbar1" pos="-1 2 0" >
            <geom name="lbar1" type="box" size="0.1 0.05 0.05" group="1" rgba="0.7 0.7 0.7 1" />
            <site name="lbar1_front" pos="0 0.05 0" quat="0.707 0 0  0.707" type="sphere" size="1e-3" group="2" rgba="1 0 0 1" />
            <site name="lbar1_rear" pos="0 -0.05 0" quat="0.707 0 0 -0.707" type="sphere" size="1e-3" group="2" rgba="1 0 0 1" />
        </body>

        <!-- Robot -->
        <body name="torso" pos="0 0 0" >
            <joint name="torso" type="free" />
            <geom name="torso" type="box" size="0.5 0.5 0.01" mass="1" group="1" rgba="0.8 0.2 0.2 1" />
            <!-- Legs -->
            <body name="left_leg_link0" pos="-0.5 -0.5 0" >
                <joint name="left_leg_joint0" pos="0 0 0" axis="0 0 1" limited="true" range="-1.5 1.5" />
                <geom name="left_leg_link0" type="cylinder" size="0.01 0.25" mass="0.5" pos="0 -0.25 0" quat="0.707107 0.707107 0 0" rgba="0.2 0.2 0.8 1" group="1" />
                <body name="left_leg_link1" pos="0 -0.5 0" >
                      <joint name="left_leg_joint1" pos="0 0 0" axis="0 0 1" limited="true" range="-1.5 1.5" />
                      <geom name="left_leg_link1" type="cylinder" size="0.01 0.25" mass="0.5" pos="0 -0.25 0" quat="0.707107 0.707107 0 0" rgba="0.2 0.2 0.8 1" group="1" />
                      <site name="left_leg_ee" pos="0 -0.5 0" type="sphere" size="1e-3" group="2" rgba="1 0 0 1" />
                </body>
            </body>
            <body name="right_leg_link0" pos="0.5 -0.5 0" >
                <joint name="right_leg_joint0" pos="0 0 0" axis="0 0 1" limited="true" range="-1.5 1.5" />
                <geom name="right_leg_link0" type="cylinder" size="0.01 0.25" mass="0.5" pos="0 -0.25 0" quat="0.707107 0.707107 0 0" rgba="0.2 0.2 0.8 1" group="1" />
                <body name="right_leg_link1" pos="0 -0.5 0" >
                      <joint name="right_leg_joint1" pos="0 0 0" axis="0 0 1" limited="true" range="-1.5 1.5" />
                      <geom name="right_leg_link1" type="cylinder" size="0.01 0.25" mass="0.5" pos="0 -0.25 0" quat="0.707107 0.707107 0 0" rgba="0.2 0.2 0.8 1" group="1" />
                      <site name="right_leg_ee" pos="0 -0.5 0" type="sphere" size="1e-3" group="2" rgba="1 0 0 1" />
                </body>
            </body>
            <!-- Arms -->
            <body name="left_arm_link0" pos="-0.5 0.5 0" >
                <joint name="left_arm_joint0" pos="0 0 0" axis="0 0 1" limited="true" range="-1.5 1.5" />
                <geom name="left_arm_link0" type="cylinder" size="0.01 0.25" mass="0.5" pos="0 0.25 0" quat="0.707107 -0.707107 0 0" rgba="0.2 0.2 0.8 1" group="1" />
                <body name="left_arm_link1" pos="0 0.5 0" >
                      <joint name="left_arm_joint1" pos="0 0 0" axis="0 0 1" limited="true" range="-1.5 1.5" />
                      <geom name="left_arm_link1" type="cylinder" size="0.01 0.25" mass="0.5" pos="0 0.25 0" quat="0.707107 -0.707107 0 0" rgba="0.2 0.2 0.8 1" group="1" />
                      <site name="left_arm_ee" pos="0 0.5 0" type="sphere" size="1e-3" group="2" rgba="1 0 0 1" />
                </body>
            </body>
            <body name="right_arm_link0" pos="0.5 0.5 0" >
                <joint name="right_arm_joint0" pos="0 0 0" axis="0 0 1" limited="true" range="-1.5 1.5" />
                <geom name="right_arm_link0" type="cylinder" size="0.01 0.25" mass="0.5" pos="0 0.25 0" quat="0.707107 -0.707107 0 0" rgba="0.2 0.2 0.8 1" group="1" />
                <body name="right_arm_link1" pos="0 0.5 0" >
                      <joint name="right_arm_joint1" pos="0 0 0" axis="0 0 1" limited="true" range="-1.5 1.5" />
                      <geom name="right_arm_link1" type="cylinder" size="0.01 0.25" mass="0.5" pos="0 0.25 0" quat="0.707107 -0.707107 0 0" rgba="0.2 0.2 0.8 1" group="1" />
                      <site name="right_arm_ee" pos="0 0.5 0" type="sphere" size="1e-3" group="2" rgba="1 0 0 1" />
                </body>
            </body>
        </body>

        <!-- Ghost representing desired pose -->
        <body name="ghost" pos="0 0 0" >
            <geom name="ghost" type="box" pos="0 0 0" size="0.5 0.5 0.005" mass="1" group="2" rgba="0.2 0.8 0.2 0.2" />
        </body>
    </worldbody>

    <actuator>
        <motor name="left_leg_j0" joint="left_leg_joint0" />
        <motor name="left_leg_j1" joint="left_leg_joint1" />
        <motor name="right_leg_j0" joint="right_leg_joint0" />
        <motor name="right_leg_j1" joint="right_leg_joint1" />
        <motor name="left_arm_j0" joint="left_arm_joint0" />
        <motor name="left_arm_j1" joint="left_arm_joint1" />
        <motor name="right_arm_j0" joint="right_arm_joint0" />
        <motor name="right_arm_j1" joint="right_arm_joint1" />
    </actuator>

    <contact>
        <pair geom1="torso"           geom2="left_leg_link1" />
        <pair geom1="torso"           geom2="right_leg_link1" />
        <pair geom1="torso"           geom2="left_arm_link1" />
        <pair geom1="torso"           geom2="right_arm_link1" />
        <pair geom1="left_arm_link1"  geom2="left_leg_link1" />
        <pair geom1="left_arm_link1"  geom2="right_arm_link1" />
        <pair geom1="left_leg_link1"  geom2="right_leg_link1" />
        <pair geom1="right_arm_link1" geom2="right_leg_link1" />
        <pair geom1="lbar0"           geom2="left_arm_link0" />
        <pair geom1="lbar0"           geom2="left_leg_link0" />
        <pair geom1="lbar0"           geom2="left_arm_link1" />
        <pair geom1="lbar0"           geom2="left_leg_link1" />
        <pair geom1="lbar1"           geom2="left_arm_link0" />
        <pair geom1="lbar1"           geom2="left_leg_link0" />
        <pair geom1="lbar1"           geom2="left_arm_link1" />
        <pair geom1="lbar1"           geom2="left_leg_link1" />
        <pair geom1="rbar0"           geom2="right_arm_link0" />
        <pair geom1="rbar0"           geom2="right_leg_link0" />
        <pair geom1="rbar0"           geom2="right_arm_link1" />
        <pair geom1="rbar0"           geom2="right_leg_link1" />
        <pair geom1="rbar1"           geom2="right_arm_link0" />
        <pair geom1="rbar1"           geom2="right_leg_link0" />
        <pair geom1="rbar1"           geom2="right_arm_link1" />
        <pair geom1="rbar1"           geom2="right_leg_link1" />
    </contact>

    <keyframe>
      <key name="init_qpos" qpos="0 0 0 1 0 0 0 0 0 0 0 0 0 0 0" />
    </keyframe>
</mujoco>
