<!-- Author + Copyright (C) Aravind Rajeswaran, rajeswaran.aravind@gmail.com. 
See LICENSE file for legal notices. LICENSE file must be kept together with this file.
Based on original model by Vikash Kumar (vikashplus@gmail.com) in the MuJoCo forum resources -->
<mujoco model="swimmer">
	<compiler inertiafromgeom="true" angle="radian" />
	<default>
		<joint limited="true" range="-1.5 1.5"/>
		<motor ctrllimited="true" ctrlrange="-1 1"/>
		<default class="body">
			<geom material="MatBody"/>
		</default>
	</default>
	
	<!--Viscosity:: water:0.000894, air:0.00001983 -->
	<!--Density:: water:1000, air:1.2 -->
	<option timestep="0.005" viscosity="0.000894" density="1000" />
	
	<asset>
        <texture type="skybox" builtin="gradient" rgb1=".1 .12 .15" rgb2="0 0 0" width="100" height="100"/>
        <texture builtin="checker" height="100" name="groundplane" rgb1=".4 .4 .45" rgb2=".15 .15 0.15" type="2d" width="100"/>
		<material name="MatBody" specular="3" shininess="0.9" reflectance="0" rgba=".3 .4 .35 1"/>
		<material name="MatGnd" texture="groundplane" texrepeat="10 10" specular="1" shininess="1" reflectance="0.00001"/>
	</asset>
	
	<worldbody>
		<light directional="true" cutoff="100" exponent="1" diffuse="1 1 1" specular=".1 .1 .1" pos="0 0 1.3" dir="-0 0 -1.3"/>
		<camera name="cam0" pos="0 -7 7" euler="0.7 0 0"/>
		<geom name="ground" material="MatGnd" type="plane" pos="0 0 0" size="10 10 1" contype="0" conaffinity="0" />
		<body pos="0 0 0.03" childclass="body" name="torso">
			<site name="eyeL" type="sphere" size="0.02" pos="-.065 -.045 .02" rgba=".9 .4 .2 1"/>
			<site name="eyer" type="sphere" size="0.02" pos="-.065 0.045 .02" rgba=".9 .4 .2 1"/>
			<site name="head" material="MatBody" type="sphere" size="0.08" pos="0 0 0" rgba="0 0 0 1"/>
			<joint type="slide" pos="0 0 0" axis="1 0 0" limited="false"/>
			<joint type="slide" pos="0 0 0" axis="0 1 0" limited="false"/>
			<joint type="hinge" pos="0 0 0" axis="0 0 1" limited="false"/>
			<geom type="capsule" pos="0.15 0 0" quat="0.707 0 -0.707 0" size="0.07 0.15" />
			<body pos="0.3 0 0">
				<joint name="j1" type="hinge" pos="0 0 0" axis="0 0 1"/>
				<geom type="capsule" pos="0.15 0 0" quat="0.707 0 -0.707 0" size="0.065 0.15" />
				<body pos="0.3 0 0">
					<joint name="j2" type="hinge" pos="0 0 0" axis="0 0 1"/>
					<geom type="capsule" pos="0.15 0 0" quat="0.707 0 -0.707 0" size="0.06 0.15" />
					<body pos="0.3 0 0">
						<joint name="j3" type="hinge" pos="0 0 0" axis="0 0 1"/>
						<geom type="capsule" pos="0.15 0 0" quat="0.707 0 -0.707 0" size="0.055 0.15" />
						<body pos="0.3 0 0">
							<joint name="j4" type="hinge" pos="0 0 0" axis="0 0 1"/>
							<geom type="capsule" pos="0.15 0 0" quat="0.707 0 -0.707 0" size="0.05 0.15" />
						</body>
					</body>
				</body>
			</body>
		</body>

	    <site name="target" pos='-5 0 0.15' type="sphere" size="0.8" rgba="1 0 0 0.5" />
	    
	</worldbody>
	
	<actuator>
		<motor joint="j1" gear="20"/>
		<motor joint="j2" gear="20"/>
		<motor joint="j3" gear="20"/>
		<motor joint="j4" gear="20"/>
	</actuator>

</mujoco>
