<mujoco model="dbar">
    <include file="./common/visual.xml"/>
    <include file="./common/skybox.xml"/>
    <include file="./common/materials.xml"/>
    
    <option timestep="0.01" iterations="50" solver="Newton" tolerance="1e-10" gravity = "0 0 -9.8/6" collision="predefined" viscosity="0"/>

    <size njmax="100" nconmax="20" nstack="400"/>

    <visual>
        <rgba haze=".15 .25 .35 1"/>
    </visual>

    <default>
        <joint type="hinge" pos="0 0 0" axis="0 1 0" limited="false" range="-180 180" damping="0"/>
        <motor ctrllimited="false" ctrlrange="-1 1"/>
		<tendon stiffness="0" damping=".0"/>
		<geom size="0.02" mass="1"/>
		<site size="0.04"/>
    </default>

    <worldbody>
        <light directional="true" diffuse=".8 .8 .8" specular=".2 .2 .2" pos="0 0 5" dir="0 0 -1"/>

        <site name="s0" pos="0 0 0"/>

        <body pos="0 0 0">
            <geom name="bar1" type="capsule" fromto="0 0 0  -1 0 1" material="self"/>
			<site name="b1e" pos="-1 0 1"/>
			<joint name="bottom1"/>
            <body pos="-1 0 1">
                <geom name="bar2" type="capsule" fromto="0 0 0  1 0 1" material="self"/>
                <joint name="left"/>
                <site name="b2e" pos="1 0 1"/>
				<body name="bar3" pos="1 0 1">
					<geom name="bar3" type="capsule" fromto="0 0 0  1 0 -1" material="self"/>
					<joint name="top"/>
					<site name="b3e" pos="1 0 -1"/>
				</body>
                <body pos="1 0 1">
                    <geom type="sphere" mass="100" size="0.05"/>
                    <site pos="0 0 0"/>
                </body>
            </body>
			<body name="bar4" pos="0 0 0">
                <geom name="bar4" type="capsule" fromto="0 0 0  1 0 1" material="self"/>
				<joint name="bottom2"/>
            </body>
        </body>
		
		<body pos="0 0 0">
			<geom name="floor" pos="0 0 0" size="0 0 1" type="plane" material="grid"/>
			<site name="s4" pos="-2 0 0"/>
			<site name="s5" pos="2 0 0"/>
			<site name="target" pos="0 0 2.5" size="0.08" rgba="1 0 0 .3"/>
		</body>
    </worldbody>
	
	<equality>
		<connect active="true" name='1bar34' body1='bar3' body2='bar4' anchor='1 -0.05 -1'/>
		<connect active="true" name='2bar34' body1='bar3' body2='bar4' anchor='1 0.05 -1'/>
	</equality>

    <tendon>
        <spatial name="S1" width="0.02">
            <site site="s0"/>
            <site site="b2e"/>
        </spatial>
		<spatial name="S2" width="0.02">
            <site site="b1e"/>
            <site site="b3e"/>
        </spatial>
		<spatial name="S3" width="0.02">
            <site site="b1e"/>
            <site site="s4"/>
        </spatial>
		<spatial name="S4" width="0.02">
            <site site="b3e"/>
            <site site="s5"/>
        </spatial>
    </tendon>   

    <actuator>
        <motor tendon="S1" gear="1"/>
        <motor tendon="S2" gear="1"/>
		<motor tendon="S3" gear="1"/>
        <motor tendon="S4" gear="1"/>
    </actuator>
	
	<sensor>
		<framelinvel objtype="site" objname="s0"/>
		<framelinvel objtype="site" objname="b1e"/>
		<framelinvel objtype="site" objname="b2e"/>
		<framelinvel objtype="site" objname="b3e"/>
		<framelinvel objtype="site" objname="s4"/>
		<framelinvel objtype="site" objname="s5"/>
	</sensor>
</mujoco>
