<!-- ======================================================
	This file is part of MuJoCo.     
	Copyright 2009-2016 Roboti LLC.
	
	Model 		:: arm_claw
		
	Mujoco		:: Advanced physics simulation engine
		Source		: www.roboti.us
		Version		: 1.31
		Released 	: 23Apr16
		
	Author		:: Vikash Kumar
		Contacts 	: kumar@roboti.us
		Last edits 	: 30Apr16, 30Nov'15, 5Nov'15
====================================================== -->
<mujoco model="arm_claw (v1.31)">
	<compiler 	inertiafromgeom="true"
				angle="radian"/>
			
	<size 	nuser_jnt="1"
			nuser_geom="1"/>

	<option	timestep="0.005"
			gravity="0 0 -2"
			viscosity="0"
			iterations="20"/>
	
	<asset>
		<material name="MatGnd" specular=".3" shininess=".3" reflectance="0.3" rgba=".5 .55 .5 1"/>
	</asset>
	
	<default>
		<joint limited="true" damping="1" stiffness="0" armature=".1" user="0"/>
		<geom solref="0.008 1" solimp="0.95 0.95 0.01" margin="0.001" user="0"/>
		<motor ctrllimited="true" ctrlrange="-1 1"/>
		<position ctrllimited="false"/>
		
		<default class='0'>
			<geom friction="1 0.005 0.001" rgba=".75 .6 .5 1" contype="1" conaffinity="0"/>
		</default>

		<default class='1'>
			<geom friction="1 0.005 0.001" rgba=".7 .6 .55 1" contype="1" conaffinity="0"/>
		</default>
		
		<default class='arm'>
			<joint damping="5"/>
		</default>
	</default>

	<worldbody>
		<light directional="true" cutoff="40" exponent="10" diffuse=".4 .4 .4" specular=".7 .7 .7" pos="0 0 1.5" dir="0 0 -1"/>
		<geom name="tableTop" material="MatGnd" type="plane" pos="0 0 0" size="0.4 0.6 0.5" rgba=".6 .6 .5 1" contype="1" conaffinity="1"/>
	                                                                
		<!--  ================= ARM ================= /-->
		<body name="board1" pos="-0.7 0 0.5" quat="0 0 0 0">
			
			<geom type="box" rgba="1 1 1 0.15" size="0.035 0.6 0.15" class="0"/>
			<body name="upperarm" pos="0 -0.4 0">
				<geom class="0" type="capsule" fromto="0 0 0 0 0 -0.345" size="0.05"/>
				<joint name='slidex1' type='slide' axis='0 1 0' range='-0.1 1'/>
				<joint name='slidey1' type='slide' axis='0 0 1' range='-0.1 0.2'/>
				<joint name='slidez1' type='slide' axis='1 0 0' range='0 0.5'/>
				<!--<joint class='arm' name="s_abduction" type="hinge" pos="0 0 0" axis="1 0 0" range="-1.57 .7" user="001"/>-->
				<!--<joint class='arm' name="s_flexion" type="hinge" pos="0 0 0" axis="0 -1 0" range="-.85 1.57" user="002"/>-->
				<!--<joint class='arm' name="s_rotation" type="hinge" pos="0 0 0" axis="0 0 1" range="-.85 .85" user="003"/> -->
				<body name="forearm" pos="0 0 -0.36">
					<geom class="0" type="capsule" fromto="0 0 0 0.225 0 0" size="0.035"/>
					<!--<joint class='arm' name="e_flexion" type="hinge" pos="0 0 0" axis="0 -1 0" range="-1.5 1.05" user="004"/>-->
					<!--<joint class='arm' name="e_pronation" type="hinge" pos="0 0 0" axis="-1 0 0" range="-1.5 1.57" user="005"/>-->
		<!--  ================= Palm ================= /-->

					<body name="claw" pos="0.27 0 0" quat="0 1 0 0">
						<geom class="1" name="Geomclaw" type="capsule" fromto="0 .02 0 0 -.02 0" size="0.01" />
						<joint name="w_abduction" type="hinge" pos="0 0 0" axis="0 0 1" range="-.5 .5" user="006"/>
						<joint name="w_flexion" type="hinge" pos="0 0 0" axis="0 -1 0" range="-1.05 1.05" user="007"/>

						<body name="rightclaw" pos=".01 -.02 0" >
							<geom name="rightclaw_it" class="1" type="capsule" fromto="0 0 0.015 .03 -.02 0.015" 	size="0.005" />
							<geom name="rightclaw_ot" class="1" type="capsule" fromto=".03 -.02 0.015 .07 0 0.015" size="0.005" />
							<geom name="rightclaw_ib" class="1" type="capsule" fromto="0 0 -0.015 .03 -.02 -0.015" 	size="0.005" />
							<geom name="rightclaw_ob" class="1" type="capsule" fromto=".03 -.02 -0.015 .07 0 -0.015" size="0.005" />
							<!--<joint name="rc_close" type="hinge" pos="0 0 0" axis="0 0 1" range="-1.05 1.05" user="008"/>-->
						</body>

						<body name="leftclaw" pos=".01 .02 0">
							<geom name="leftclaw_it" class="1" type="capsule" fromto="0 0 0.015 .03 .02 0.015" 	size="0.005" />
							<geom name="leftclaw_ot" class="1" type="capsule" fromto=".03 .02 0.015 .07 0 0.015" size="0.005" />
							<geom name="leftclaw_ib" class="1" type="capsule" fromto="0 0 -0.015 .03 .02 -0.015" 	size="0.005" />
							<geom name="leftclaw_ob" class="1" type="capsule" fromto=".03 .02 -0.015 .07 0 -0.015" size="0.005" />
							
						</body>
					
					</body>
				
				</body>
			
			</body>
		</body>
                                                           
	
		<!--  ================= OBJECT ================= pos="0 -0.4 0.06" quat="0 0 0 0" /-->
		

		<body name="goal" pos="0 0.4 0.01" quat="0 0 0 0" >
			<geom  type="box" rgba="0 1 0 0.1" size="0.25 0.025 0.001" user="1" contype="0" conaffinity="1"/>
			<joint name="fr2" type="free" limited='false' damping="2" armature="0"/>
		</body>
	
	</worldbody>
	
	<actuator>
		<!--  ================= Torque actuators ================= /-->
		<!--<motor joint='s_abduction' 	name='As_abduction' gear="100"/>
		<motor joint='s_flexion' 	name='As_flexion' 	gear="100"/>
		<motor joint='s_rotation' 	name='As_rotation' 	gear="100"/>
		<motor joint='e_flexion' 	name='Ae_flexion' 	gear="70"/>
		<motor joint='e_pronation' 	name='Ae_pronation' gear="70"/>
		<motor joint='w_abduction' 	name='Aw_abduction' gear="30"/>
		<motor joint='w_flexion' 	name='Aw_flexion' 	gear="30"/>
		<motor joint='rc_close' 	name='Arc_close' 	gear="10"/>
		<motor joint='lc_close' 	name='Alc_close' 	gear="10"/>-->
		
		<!--  ================= Position actuators ================= /-->
		  
		<!--<motor name='bossx1' 	gear='50' joint='ballx1'/>
		<motor name='bossz1' 	gear='50' joint='ballz1'/>-->

		<position joint="slidex1" name="sliderx1" kp="10" ctrlrange="-1 1"/>
		<position joint="slidey1" name="slidery1" kp="10" ctrlrange="-1 1"/>
		<position joint="slidez1" name="sliderz1" kp="10" ctrlrange="-1 1"/>
		<!--<position joint='s_abduction' 	name='As_abduction' kp="100" ctrlrange='-1.57 .7'/>-->
		<!--<position joint='s_flexion' 	name='As_flexion' 	kp="100" ctrlrange='-.85 1.57'/>-->
		<!--<position joint='s_rotation' 	name='As_rotation' 	kp="100" ctrlrange='-.85 0.85'/>-->
		<!--<position joint='e_flexion' 	name='Ae_flexion' 	kp="70"  ctrlrange='-1.5 1.05'/>-->
		<!--<position joint='e_pronation' 	name='Ae_pronation' kp="70"  ctrlrange='-1.5 1.57'/> -->
		<!--<position joint='w_abduction' 	name='Aw_abduction' kp="30"  ctrlrange='-0.5 0.5'/> -->
		<!--<position joint='w_flexion' 	name='Aw_flexion' 	kp="30"  ctrlrange='-1.05 1.05'/> 
		<position joint='rc_close' 		name='Arc_close' 	kp="10"  ctrlrange='-1.05 1.05'/>-->
		

		<!--<position joint='s_abduction2' 	name='As_abduction2' kp="100" ctrlrange='-1.57 .7'/>
		<position joint='s_flexion2' 	name='As_flexion2' 	kp="100" ctrlrange='-.85 1.57'/>
		<position joint='s_rotation2' 	name='As_rotation2' 	kp="100" ctrlrange='-.85 0.85'/>
		<position joint='e_flexion2' 	name='Ae_flexion2' 	kp="70"  ctrlrange='-1.5 1.05'/>
		<position joint='e_pronation2' 	name='Ae_pronation2' kp="70"  ctrlrange='-1.5 1.57'/>
		<position joint='w_abduction2' 	name='Aw_abduction2' kp="30"  ctrlrange='-0.5 0.5'/>
		<position joint='w_flexion2' 	name='Aw_flexion2' 	kp="30"  ctrlrange='-1.05 1.05'/>
		<position joint='rc_close2' 		name='Arc_close2' 	kp="10"  ctrlrange='-1.05 1.05'/>-->
	
	</actuator>

</mujoco>
