#VRML V2.0 utf8

# Name: ANH LE
# SID: 13291487
# CS 184 Fall 98
# Section: 104
# Lab 3
# Due date: 9/16/98
# Developed on SGI in lab

Transform {
   rotation 1 0 0 -1.5708
   children [
      DEF robot Transform {
	 rotation 1 0 0 1.5708
   children [
      Transform {
	 translation 2 -2.95 0
	 scale 2.5 0.15 2.5
	 children [
	    DEF rod Shape {
	       appearance DEF rodCl Appearance {
		  material Material { 
		     diffuseColor 0.5 0.5 0.5 
		     specularColor 0.2 0.4 0.3
		     shininess 0.6
		  }} 
	       geometry Cylinder {
		  height 5
		  radius 0.5
	       }}]
      }
      DEF waistSensor Transform {
	 translation 2 0 0
	 children [
	    DEF waist Shape {
	       appearance DEF waistCl Appearance {
		  material Material { 
		     diffuseColor 0.2 0.9 0.9 
		     specularColor 0.4 1 0.2
		     shininess 1
		  }} 
	       geometry Cylinder {
		  height 5
		  radius 0.5
	       }
	    }
      
	    Transform {
	       translation 0 -2.5 0
	       scale 2 0.05 2
	       children [USE waist]
	       
	    }
      
	    Transform {
	       translation 1.5 2 0
	       rotation 0 0 1 1.5708
	       scale 0.6 1 0.6
	       children [
		  USE rod
		 ]
	    }
      
	    Transform {
	       translation -0.5 2 0
	       rotation 0 0 1 1.5708
	       children [
		  DEF my_bolt Shape {
		     appearance DEF boltCl Appearance {
			material Material { 
			   diffuseColor 0.5 0.2 0.2 
			}} 
		     geometry Cylinder {
			height 0.15
			radius 0.35
		     }
		  }]
	    }
	    
	    Transform {
	       rotation 0 0 1 -1.5708
	       children [
		  DEF shoulderSensor Transform {
		     center -2 4.5 0
		     children [
			Transform {
			   rotation 0 0 1 1.5708
			  
			   children [
			      Transform {
				 translation 2.5 1.5 0
				# rotation  1 0 0 2.5
				 children [
				    DEF shoulder Shape {
				       appearance DEF shoulderCl Appearance {
					  material Material { 
					     diffuseColor 0.4 0.2 0.6 
					    
					  }} 
				       geometry Box {
					  size 0.35 2.5 0.8
				       }
				    }
				   ]
			      }
			      
			      Transform {
				 translation 3.4 1.5 0
				# rotation 1 0 0 2.5
				 children [ USE shoulder]
			      }
			     Transform {
				translation 3 0.8 0
				rotation 0 0 1 1.5708
				scale 0.4 0.35 0.4
				children [USE rod]
			     }
			      Transform {
				 translation 2.3 0.8 0
				 rotation 0 0 1 1.5708
				 scale 0.8 0.8 0.8
				 children [USE my_bolt]
			      }
			      Transform {
				 translation 3.6 0.8 0
				 rotation 0 0 1 1.5708
				 scale 0.8 0.8 0.8
				 children [USE my_bolt]
			      } 
			      Transform {
				 rotation 0 0 1 -1.5708
				 children [
				    DEF elbowSensor Transform {
				       center -0.8 2.95 0
				       children [
					  Transform {
					     rotation 0 0 1 1.5708
					     
					     children [
						Transform {
						   translation 2.95  0  0
						   
						   children [
						      DEF elbow Shape {
							 appearance DEF elbowCl Appearance {
							    material Material { 
							       diffuseColor 1.0 0.2 0.5 
							       
							    }} 
							 geometry Box {
							    size 0.4 2.5 0.8
							 }
						      } ]
						}
						
						DEF wristSensor Transform {
						   translation 3 -1.5 0
						   children [
						      DEF wrist Transform {
							 scale 0.2 0.2 0.2
							 children [
							    Shape {
							       appearance DEF wristCl Appearance {
								  material Material { 
								     diffuseColor  0 0 1
								     specularColor 0.2 0.4 0.4
								     shininess 0.8
								  }} 
							       geometry Cylinder {
								  height 5
								  radius 0.5
							       }
							    }
							   ]
						      }
						      Transform {
							 
							 translation 0 -0.3 0
							 scale 0.1 0.3 0.1 
							 rotation  0 0 1 1.5708 
							 children [ USE rod]
						      }
						      
						      
						      Transform {
							 translation -0.35 -0.3 0
							 scale 0.35 0.07 0.35 
							 rotation  0 0 1 1.5708 
							 children [
							    DEF hand Shape {
							       appearance DEF handCl Appearance {
								  material Material { 
								     diffuseColor 1 0 0 
								     specularColor 1 0.4 0
								     shininess 0.6
								  }} 
							       geometry Cylinder {
								  height 5
								  radius 0.5
							       }}
							   ]
						      }
						      
						      Transform {
							 translation 0.35 -0.3 0
							 scale 0.35 0.07 0.35 
							 rotation  0 0 1 1.5708 
							 children [ USE hand]
						      }
						      
						      Transform {
							 rotation 0 0 1 -1.5708
							 children [
							    DEF handSensor Transform {
							       center 0.3 0 0
							       children [
								  Transform {
								     rotation 0 0 1 1.5708
								     children [		
									Transform {
									   translation -0.58 -0.5 0
									   scale 0.3 0.3 0.3
									   children [
									      DEF upperfinger Shape {
										 appearance USE handCl 
										 geometry Box {
										    size 0.35 2.5 0.8
										 }
									      }
									     ]
									}
									
									Transform {
									   translation 0.58 -0.5 0
									   scale 0.3 0.3 0.3
									   
									   children [ USE upperfinger]
									}
									Transform {
									   rotation 1 0 0 -1.5708
									   children [
									      DEF rightfingerSensor Transform {
										 center 0.45 0 -0.8
										 #rotation 0 1 0 0.9
										 children [
										    Transform {
										       rotation 1 0 0  1.5708
										       children [		
											  Transform {
											     translation  0.58 -1.1 0
											     scale 0.35 0.3 0.06
											     children [
												DEF lowfinger Shape {
												   appearance DEF fingerCl Appearance {
												      material Material { 
													 diffuseColor 0 1 0 
													 specularColor 0.2 0.4 0.3
													 shininess 0.6
												      }} 
												   geometry Box {
												      size 0.35 3 0.8
												   }
												}]
											  }
											  
											 ]
										    }
										   ]
									      }
									     ]
									}
									Transform {
									   rotation 1 0 0 1.5708
									   children [
									      DEF leftfingerSensor Transform {
										 center -0.5 0 0.55
										 children [
										    Transform {
										       rotation 1 0 0  -1.5708
										       children [		
											  Transform {
											     translation  -0.58 -1.1 0
											     scale 0.35 0.3 0.06
											     children [
												DEF lowfinger Shape {
												   appearance DEF fingerCl Appearance {
												      material Material { 
													 diffuseColor 0 1 0 
													 specularColor 0.2 0.4 0.3
													 shininess 0.6
												      }} 
												   geometry Box {
												      size 0.35 3 0.8
												   }
												}]
											  }
											  # Transform {
											  #    translation 0.58 -1 0
											  #    scale 0.35 0.3 0.06
											  #    
											  #    children [ USE lowfinger]
											  # }
											 ]
										    }
										   ]
									      }
									     ]
									}
								       ]
								  }
								 ]
							    }
							   ]
						      }
						     ]
						}
					       ]
					  }
					 ]
				    }
				   ]
			      }
			     ]
			}
		       ]
		  }
		 ]
	    }
	   ]
      }
     ]
      }
     ]
}


DEF waistLever Transform {
   translation -5.5 4 0
   children [
      DEF waistControl CylinderSensor {
	 minAngle   -1.5
	 maxAngle    1.5
      }
      Group {
	 children [
	    Transform {
	       rotation 1 0 0 1.5708
	       children [
		  
		  Transform {
		     translation 0 1.5 0 
		     children [
			Shape {
			   appearance USE  waistCl 
			   geometry Sphere {
			      radius 0.25
			}
			}]
		  }
		  Transform {
		     translation 0 0.7 0
		     
		     children [
			Shape {
			   appearance USE waistCl
			   geometry Cylinder {
			      radius 0.15
			      height 1.5
			   }
			}
		       ]
		  }
		 ]
	    }
	   ]
      }
     ]
}

Transform {
   translation  -6.5 1.9 0
   rotation    0 0 1 -1.5708
   children [ 
      DEF shoulderLever Transform {
	
	 rotation 0 0 1 -1.5708
	 children [
	    DEF shoulderControl CylinderSensor {
	       minAngle   -2
	       maxAngle    2
	    }
	    Group {
	       children [
		  Transform {
		     rotation 1 0 0 1.5708
		     children [
			
			Transform {
			   translation 0 1.5 0 
			   children [
			      Shape {
				 appearance USE shoulderCl 
				 
				 geometry Sphere {
				    radius 0.25
				 }
			      }]
			}
			Transform {
			   translation 0 0.7 0
			   children [
			      Shape {
				 appearance USE shoulderCl
				 geometry Cylinder {
				    radius 0.15
				    height 1.5
				 }
			      }
			     ]
			}
		       ]
		  }
		 ]
	    }
	   ]
      }
     ]
}

Transform {
   translation  -4.5 1.9 0
   rotation    0 0 1 -1.5708
   children [ 
      DEF elbowLever Transform {
	
	 rotation 0 0 1 -1.5708
	 children [
	    DEF elbowControl CylinderSensor {
	       minAngle     -0.785
	       maxAngle      0.785
	    }
	    Group {
	       children [
		  Transform {
		     rotation 1 0 0 1.5708
		     children [
			
			Transform {
			   translation 0 1.5 0 
			   children [
			      Shape {
				 appearance USE elbowCl 
				 geometry Sphere {
				    radius 0.25
				 }
			      }]
			}
			Transform {
			   translation 0 0.7 0
			   
			   children [
			      Shape {
				 appearance USE elbowCl
				 geometry Cylinder {
				    radius 0.15
				    height 1.5
				 }
			      }
			     ]
			}
		       ]
		  }
		 ]
	    }
	   ]
      }
     ]
}

DEF wristLever Transform {
   translation -6.5 -0.2 0
   children [
      DEF wristControl CylinderSensor {
	 minAngle   -1.5708
	 maxAngle    1.5708
      }
      Group {
	 children [
	    Transform {
	       rotation 1 0 0 1.5708
	       children [
		  
		  Transform {
		     translation 0 2 0 
		     children [
			Shape {
			   appearance USE  wristCl 
			   
			   geometry Sphere {
			      radius 0.25
			}
			}]
		  }
		  Transform {
		     translation 0 1 0
		     
		     children [
			Shape {
			   appearance USE wristCl
			   geometry Cylinder {
			   radius 0.15
			      height 2
			   }
			}
		       ]
		  }
		 ]
	    }
	   ]
      }
     ]
}

Transform {
   translation  -3.5 -0.2 0
   rotation    0 0 1 -1.5708
   children [ 
      DEF handLever Transform {
	
	 rotation 0 0 1 -1.5708
	 children [
	    DEF handControl CylinderSensor {
	       minAngle   -0.9
	       maxAngle    0.9
	    }
	    Group {
	       children [
		  Transform {
		     rotation 1 0 0 1.5708
		     children [
			
			Transform {
			   translation 0 1.5 0 
			   children [
			      Shape {
				 appearance USE handCl 
				 
				 geometry Sphere {
				    radius 0.25
				 }
			      }]
			}
			Transform {
			   translation 0 0.7 0
			   children [
			      Shape {
				 appearance USE handCl
				 geometry Cylinder {
				    radius 0.15
				    height 1.5
				 }
			      }
			     ]
			}
		       ]
		  }
		 ]
	    }
	   ]
      }
     ]
}

DEF fingerLever Transform {
   translation -6.5 -1.6 0
   children [
      DEF fingerControl CylinderSensor {
	 minAngle    0
	 maxAngle    0.5
      }
      Group {
	 children [
	    Transform {
	       rotation 1 0 0 1.5708
	       children [
		  
		  Transform {
		     translation 0 2 0 
		     children [
			Shape {
			   appearance USE  fingerCl 
			   
			   geometry Sphere {
			      radius 0.25
			}
			}]
		  }
		  Transform {
		     translation 0 1 0
		     
		     children [
			Shape {
			   appearance USE fingerCl
			   geometry Cylinder {
			   radius 0.15
			      height 2
			   }
			}
		       ]
		  }
		 ]
	    }
	   ]
      }
     ]
}
Transform {
   translation -5.5 4 0
   rotation 1 0 0 1.5708
   children [
      DEF base Shape {
	 appearance USE rodCl
	 geometry Extrusion {
	    crossSection [ 
			  1.0000    0.0000 # Coordinates of a unit CCW circle
			  0.8090   -0.5878
			  0.3090   -0.9511
			  -0.3090   -0.9511
			  -0.8090   -0.5878
			  -1.0000    0.0000
			  -0.8090    0.5878
			  -0.3090    0.9511
			  0.3090    0.9511
			  0.8090    0.5878
			  1.0000    0.0000
		       ]
	    spine [
		   0 0 -0.05
		   0 0 0.05
		  ] 
	    scale [0.5 0.5]
	    endCap TRUE
	    beginCap TRUE
	    solid FALSE
	    convex FALSE
	 }
      }
      
     ]
}

# base of shoulderLever
Transform {
   translation  -6.5 1.9 0
   rotation  0  1 0  -1.5708
   children [USE base]
}

# base of elbowLever
Transform {
   translation -4.5 1.9 0
   rotation  0  1 0  -1.5708
   children [USE base]
}

# base of wristLever
Transform {
   rotation 1 0 0 1.5708
   translation -6.5 -0.2 0
   children [USE base]
}

# base of handLever
Transform {
   translation  -3.5 -0.2 0
   rotation  0  1 0  -1.5708
   children [USE base]
}

# base of fingerLever
Transform {
   translation -6.5 -1.6 0
   rotation  1 0  0  1.5708
   children [USE base]
}

Transform {
   translation -5.5 -0.8 -0.5
   children [
      Shape {
	 appearance DEF panelCl Appearance {
	    material Material { 
	       diffuseColor 0.8 0.6 0.5
	       
	    }} 
	 geometry  Box {
	    size 5 11 0.5
	 }
      }
]
}

Transform {
   translation -5.3 -4.5 0
   children [
      Shape {
	 appearance DEF sliderpanelCl Appearance {
	    material Material { 
	       diffuseColor 1 0.5 0.2
	       
	    }} 
	 geometry  Box {
	    size 4.1 2.8 1
	 }
      }
]
}

Transform {
   translation -5.5 -4.5 0.75
   children [
      DEF panel Transform {
	 children [
	    DEF sliderControl PlaneSensor {
	       minPosition -1.2 -1
	       maxPosition 1.6 1
	    }
	    Shape {
	       appearance DEF sliderCl Appearance {
		  material Material { 
		     diffuseColor 1 1 0
		  }}   
	       geometry Box {
		  size 0.5 0.5 0.5
	       }
	    }
	   ]
      }]
}      


ROUTE waistControl.rotation_changed TO waistLever.set_rotation
ROUTE waistControl.rotation_changed TO waistSensor.set_rotation
ROUTE shoulderControl.rotation_changed TO shoulderLever.set_rotation
ROUTE shoulderControl.rotation_changed TO shoulderSensor.set_rotation
ROUTE elbowControl.rotation_changed TO elbowLever.set_rotation
ROUTE elbowControl.rotation_changed TO elbowSensor.set_rotation
ROUTE wristControl.rotation_changed TO wristLever.set_rotation
ROUTE wristControl.rotation_changed TO wristSensor.set_rotation
ROUTE handControl.rotation_changed TO  handLever.set_rotation
ROUTE handControl.rotation_changed TO  handSensor.set_rotation
ROUTE fingerControl.rotation_changed TO  fingerLever.set_rotation
ROUTE fingerControl.rotation_changed TO  leftfingerSensor.set_rotation
ROUTE fingerControl.rotation_changed TO  rightfingerSensor.set_rotation


ROUTE sliderControl.translation_changed TO panel.set_translation
ROUTE sliderControl.translation_changed TO robot.set_translation

Viewpoint {
   position -1 0 15
   description "Front"
}


NavigationInfo {
   type "EXAMINE"
}