<!-- ======================================================
	This file is part of MuJoCo.     
	Copyright 2009-2016 Roboti LLC.
	
	Model 		:: arm_hand
		
	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 #0.001
====================================================== -->
<mujoco model="arm_hand (v1.31)">
	<compiler 	inertiafromgeom="true"
				angle="radian"/>

	<size 	nuser_jnt="1"
			nuser_geom="1"/>

	<option	timestep="0.01"
			gravity="0 0 -9.8"
			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"/> #true
		
		<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"/> #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"/>

	                                                                
		<!--  ================= ARM ================= /-->
		<body name="upperarm" pos="-0.15 0 0.6">
			<geom class="0" type="capsule" fromto="0 0 0 0 0 -0.345" size="0.05" mass="1.978"/><!--Total: 3.606  ratio: 0.54853-->
			<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" mass="1.183" /><!--Total: 3.606  ratio: 0.32806-->
				<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="palm" pos="0.27 0 0">
					<geom class="1" name="palm" type="box" size="0.045 0.04 0.01" pos="0.045 0 0" mass="0.445"/><!--Total: 3.606  ratio: 0.12341-->
					<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="finger" pos=".09 0 0">
						<geom name="FFP" class="1" type="capsule" fromto=".00  .024 0 		.03   .024 0" 		size="0.008" />
						<geom name="FFM" class="1" type="capsule" fromto=".03  .024 0 		.06   .024 -.01" 	size="0.0075" />
						<geom name="FFD" class="1" type="capsule" fromto=".06  .024 -.01 	.075  .024 -.018" 	size="0.007" />

						<geom name="MFP" class="1" type="capsule" fromto=".00 -.008 0 		.03  -.008 0" 		size="0.008"/>
						<geom name="MFM" class="1" type="capsule" fromto=".03 -.008 0 		.06  -.008 -.01" 	size="0.0075" />
						<geom name="MFD" class="1" type="capsule" fromto=".06 -.008 -.01 	.075 -.008 -.018" 	size="0.007" />

						<geom name="RFP" class="1" type="capsule" fromto=".00  .008 0 		.03   .008 0" 		size="0.008" />
						<geom name="RFM" class="1" type="capsule" fromto=".03  .008 0 		.06   .008 -.01" 	size="0.0075" />
						<geom name="RFD" class="1" type="capsule" fromto=".06  .008 -.01 	.075  .008 -.018" 	size="0.007" />

						<geom name="LFP" class="1" type="capsule" fromto=".00 -.024 0 		.03  -.024 0" 		size="0.008" />
						<geom name="LFM" class="1" type="capsule" fromto=".03 -.024 0 		.06  -.024 -.01" 	size="0.0075" />
						<geom name="LFD" class="1" type="capsule" fromto=".06 -.024 -.01 	.075 -.024 -.018" 	size="0.007" />
						<body name="fingertip" pos="-0.02 0 0">
							<geom contype="0" name="fingertip" pos="-0.02 0 0" rgba="0.0 0.8 0.6 1" size=".015" type="sphere" />
                        </body>
					</body>
				</body>
			</body>
		</body>

			<!-- Target -->

			<body name="target" pos=".15 0.01 -.1">
				<!--<joint armature="0" axis="1 0 0" damping="0" limited="true" name="target_x" pos="0 0 0" range="-.27 .27" ref=".1" stiffness="0" type="slide"/>
				<joint armature="0" axis="0 0 1" damping="0" limited="true" name="target_z" pos="0 0 0" range="-.27 .27" ref="-.1" stiffness="0" type="slide"/>-->
				<!--<geom conaffinity="0" contype="0" name="target" pos="0 0 0" rgba="0.9 0.2 0.2 1" size=".009" type="sphere" mass="0.0000000001"/>-->
				<site  name="target" pos="0.1 0 0.4" rgba="0.9 0.2 0.2 1" size=".009 .009 .009" type="sphere" />
			</body>

  		</worldbody>

		


	<actuator>
		<motor ctrllimited="true" ctrlrange="-1 1" gear="100.0" joint='s_abduction'/>##check this
		<motor ctrllimited="true" ctrlrange="-1 1" gear="100.0" joint='s_flexion' />##check this
		<motor ctrllimited="true" ctrlrange="-1 1" gear="100.0" joint='s_rotation'/>#
		<motor ctrllimited="true" ctrlrange="-1 1" gear="100.0" joint='e_flexion' />##check this
		<motor ctrllimited="true" ctrlrange="-1 1" gear="100.0" joint='e_pronation'/>##check this
		<motor ctrllimited="true" ctrlrange="-1 1" gear="100.0" joint='w_abduction'/>#
		<motor ctrllimited="true" ctrlrange="-1 1" gear="100.0" joint='w_flexion'/>##check this
	</actuator>
</mujoco>

