#VRML V2.0 utf8 # lab4 ############################ ## structure of the robot ## ############################ Transform { rotation 1.0 0.0 0.0 1.57 children [ DEF base Transform { rotation 1.0 0.0 0.0 -1.57 children [ DEF arm1Transform Transform { children [ Shape { appearance Appearance { material Material { diffuseColor 0.8 0.8 0.8 } } geometry Extrusion { crossSection [ -.75 .25 -.25 .75 .25 .75 .75 .25 .75 -.25 .25 -.75 -.25 -.75 -.75 -.25 -.75 .25 ] spine [ 0.0 0.0 0.0 0.0 0.4 0.0 0.0 0.8 0.0 0.0 1.2 0.0 0.0 2.4 0.0 ] scale [ 1.2 1.2 1.15 1.15 1.0 1.0 0.9 0.9 0.9 0.9 ] beginCap TRUE endCap TRUE solid TRUE } } Transform { children [ DEF arm2Transform Transform { translation 0.0 3.0 0.0 children [ Transform { rotation 0.0 0.0 1.0 -1.57 children [ Transform { translation 1.0 2.0 0.0 children [ Shape { appearance Appearance { material Material { diffuseColor 0.8 0.0 0.0 } } geometry Cylinder { radius 0.3 height 3.0 } } ] } ] } Transform { rotation 1.0 0.0 0.0 -1.57 translation 3.4 -1.0 1.15 children [ DEF arm3Transform Transform { children [ Transform { rotation 0.0 0.0 1.0 -1.57 translation 0.52 1.7 0.0 children [ Shape { appearance Appearance { material Material { diffuseColor 0.0 0.8 0.0 } } geometry Cylinder { radius 0.3 height 2.0 } } ] } Transform { translation 1.4 1.67 0.0 children [ DEF handTransform Transform { children [ Transform { rotation 0.0 1.0 0.0 1.57 children [ Group { children [ Transform { rotation 1.0 0.0 0.0 0.9 children [ DEF finger Transform { translation 0.0 0.4 0.0 children [ Shape { appearance Appearance { material Material { diffuseColor 0.0 0.0 0.8 } } geometry Box { size 0.2 0.65 0.07 } } ] } ] } Transform { rotation 0.0 0.0 1.0 2.09 children [ Transform { rotation 1.0 0.0 0.0 1.2 children [ USE finger ] } ] } Transform { rotation 0.0 0.0 1.0 -2.09 children [ Transform { rotation 1.0 0.0 0.0 1.2 children [ USE finger ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ]} #################### ## remote control ## #################### Transform { translation 0.5 -3.1 0.0 rotation 1.0 0.0 0.0 1.57 children [ DEF baseRemote Transform { rotation 1.0 0.0 0.0 -1.57 children [ Transform { translation -0.32 -0.6 0.0 children [ Shape { appearance Appearance { material Material { diffuseColor 0.2 0.9 0.2 } } geometry Text { string "slider" fontStyle FontStyle { size 0.35 } } } ] } Shape { appearance Appearance { material Material { diffuseColor 0.2 0.9 0.2 } } geometry Sphere { radius 0.3 } } ] } DEF baseSensor PlaneSensor { } DEF baseRemoteSensor PlaneSensor { } ] } DEF controls Transform { translation 2.5 -4.0 0.0 rotation 0.0 0.0 1.0 1.57 children [ Transform { translation 0.0 0.1 0.0 children [ Shape { appearance Appearance { material Material { diffuseColor 0.8 0.8 0.8 } } geometry Text { string "arm1" fontStyle FontStyle { size 0.35 } } } ] } DEF arm1Remote Transform { children [ Transform { translation 0.5 0.0 0.0 rotation 0.0 0.0 1.0 -1.57 children [ DEF generic Shape { appearance Appearance { material Material { diffuseColor 0.8 0.8 0.8 } } geometry Cylinder { radius 0.07 height 1.0 } } ] } DEF arm1Sensor CylinderSensor { } DEF arm1RemoteSensor CylinderSensor { } ] } Transform { translation 0.0 -0.4 0.0 children [ Shape { appearance Appearance { material Material { diffuseColor 0.8 0.0 0.0 } } geometry Text { string "arm2" fontStyle FontStyle { size 0.35 } } } ] } DEF arm2Remote Transform { translation 0.0 -0.5 0.0 children [ Transform { translation 0.5 0.0 0.0 rotation 0.0 0.0 1.0 -1.57 children [ Shape { appearance Appearance { material Material { diffuseColor 0.8 0.0 0.0 } } geometry Cylinder { radius 0.07 height 1.0 } } ] } DEF arm2Sensor CylinderSensor { } DEF arm2RemoteSensor CylinderSensor { } ] } Transform { translation 0.0 -0.9 0.0 children [ Shape { appearance Appearance { material Material { diffuseColor 0.0 0.8 0.0 } } geometry Text { string "arm3" fontStyle FontStyle { size 0.35 } } } ] } DEF arm3Remote Transform { translation 0.0 -1.0 0.0 children [ Transform { translation 0.5 0.0 0.0 rotation 0.0 0.0 1.0 -1.57 children [ Shape { appearance Appearance { material Material { diffuseColor 0.0 0.8 0.0 } } geometry Cylinder { radius 0.07 height 1.0 } } ] } DEF arm3Sensor CylinderSensor { } DEF arm3RemoteSensor CylinderSensor { } ] } Transform { translation 0.0 -1.4 0.0 children [ Shape { appearance Appearance { material Material { diffuseColor 0.0 0.0 0.8 } } geometry Text { string "hand" fontStyle FontStyle { size 0.35 } } } ] } DEF handRemote Transform { translation 0.0 -1.5 0.0 children [ Transform { translation 0.5 0.0 0.0 rotation 0.0 0.0 1.0 -1.57 children [ Shape { appearance Appearance { material Material { diffuseColor 0.0 0.0 0.8 } } geometry Cylinder { radius 0.07 height 1.0 } } ] } DEF handSensor CylinderSensor { maxAngle 1.5 minAngle -1.5 } DEF handRemoteSensor CylinderSensor { maxAngle 1.5 minAngle -1.5 } ] } ] } ############## # main clock # ############## DEF MainClock TimeSensor { cycleInterval 0.1 loop TRUE } ################## # recorder nodes # ################## DEF J1Recorder Script { url "recorder.class" field SFString filename "joint1.wrl" field SFString nodename "joint1" field SFRotation current_rotation 0 1 0 0 eventIn SFRotation set_rotation eventIn SFBool record eventIn SFBool toggle eventIn SFFloat interpolate eventOut SFRotation rotation_changed eventIn SFBool back eventIn SFBool forward } DEF J2Recorder Script { url "recorder.class" field SFString filename "joint2.wrl" field SFString nodename "joint2" field SFRotation current_rotation 0 1 0 0 eventIn SFRotation set_rotation eventIn SFBool record eventIn SFBool toggle eventIn SFFloat interpolate eventOut SFRotation rotation_changed eventIn SFBool back eventIn SFBool forward } DEF J3Recorder Script { url "recorder.class" field SFString filename "joint3.wrl" field SFString nodename "joint3" field SFRotation current_rotation 0 1 0 0 eventIn SFRotation set_rotation eventIn SFBool record eventIn SFBool toggle eventIn SFFloat interpolate eventOut SFRotation rotation_changed eventIn SFBool back eventIn SFBool forward } DEF J4Recorder Script { url "recorder.class" field SFString filename "joint4.wrl" field SFString nodename "joint4" field SFRotation current_rotation 0 1 0 0 eventIn SFRotation set_rotation eventIn SFBool record eventIn SFBool toggle eventIn SFFloat interpolate eventOut SFRotation rotation_changed eventIn SFBool back eventIn SFBool forward } ################### # control buttons # ################### DEF text1 Transform { translation 4.7 -0.4 0.0 children [ Shape { appearance Appearance { material Material { diffuseColor 1.0 0.0 0.0 } } geometry Text { string "record" fontStyle FontStyle { size 0.25 } } } ] } DEF text2 Transform { translation 4.7 -1.1 0.0 children [ Shape { appearance Appearance { material Material { diffuseColor 0.0 1.0 0.0 } } geometry Text { string "toggle" fontStyle FontStyle { size 0.25 } } } ] } DEF text3 Transform { translation 4.7 -1.8 0.0 children [ Shape { appearance Appearance { material Material { diffuseColor 0.0 0.0 1.0 } } geometry Text { string "back" fontStyle FontStyle { size 0.25 } } } ] } DEF text4 Transform { translation 4.7 -2.5 0.0 children [ Shape { appearance Appearance { material Material { diffuseColor 1.0 0.0 1.0 } } geometry Text { string "forward" fontStyle FontStyle { size 0.25 } } } ] } DEF record_button Transform { rotation 1.0 0.0 0.0 1.57 translation 5.0 0.0 0.0 children [ Shape { appearance Appearance { material Material { diffuseColor 1.0 0.0 0.0 } } geometry Cylinder { radius 0.2 height 0.2 } } DEF record_sensor TouchSensor { } ] } DEF toggle_button Transform { rotation 1.0 0.0 0.0 1.57 translation 5.0 -0.7 0.0 children [ Shape { appearance Appearance { material Material { diffuseColor 0.0 1.0 0.0 } } geometry Cylinder { radius 0.2 height 0.2 } } DEF toggle_sensor TouchSensor { } ] } DEF back_button Transform { rotation 1.0 0.0 0.0 1.57 translation 5.0 -1.4 0.0 children [ Shape { appearance Appearance { material Material { diffuseColor 0.0 0.0 1.0 } } geometry Cylinder { radius 0.2 height 0.2 } } DEF back_sensor TouchSensor { } ] } DEF forward_button Transform { rotation 1.0 0.0 0.0 1.57 translation 5.0 -2.1 0.0 children [ Shape { appearance Appearance { material Material { diffuseColor 1.0 0.0 1.0 } } geometry Cylinder { radius 0.2 height 0.2 } } DEF forward_sensor TouchSensor { } ] } ########### # routing # ########### ROUTE MainClock.fraction_changed TO J1Recorder.interpolate ROUTE MainClock.fraction_changed TO J2Recorder.interpolate ROUTE MainClock.fraction_changed TO J3Recorder.interpolate ROUTE MainClock.fraction_changed TO J4Recorder.interpolate ROUTE record_sensor.isActive TO J1Recorder.record ROUTE record_sensor.isActive TO J2Recorder.record ROUTE record_sensor.isActive TO J3Recorder.record ROUTE record_sensor.isActive TO J4Recorder.record ROUTE toggle_sensor.isActive TO J1Recorder.toggle ROUTE toggle_sensor.isActive TO J2Recorder.toggle ROUTE toggle_sensor.isActive TO J3Recorder.toggle ROUTE toggle_sensor.isActive TO J4Recorder.toggle ROUTE back_sensor.isActive TO J1Recorder.back ROUTE back_sensor.isActive TO J2Recorder.back ROUTE back_sensor.isActive TO J3Recorder.back ROUTE back_sensor.isActive TO J4Recorder.back ROUTE forward_sensor.isActive TO J1Recorder.forward ROUTE forward_sensor.isActive TO J2Recorder.forward ROUTE forward_sensor.isActive TO J3Recorder.forward ROUTE forward_sensor.isActive TO J4Recorder.forward ROUTE baseSensor.translation_changed TO base.set_translation ROUTE baseRemoteSensor.translation_changed TO baseRemote.set_translation ROUTE arm1RemoteSensor.rotation_changed TO J1Recorder.set_rotation ROUTE J1Recorder.rotation_changed TO arm1Transform.set_rotation ROUTE J1Recorder.rotation_changed TO arm1Remote.set_rotation ROUTE arm2RemoteSensor.rotation_changed TO J2Recorder.set_rotation ROUTE J2Recorder.rotation_changed TO arm2Transform.set_rotation ROUTE J2Recorder.rotation_changed TO arm2Remote.set_rotation ROUTE arm3RemoteSensor.rotation_changed TO J3Recorder.set_rotation ROUTE J3Recorder.rotation_changed TO arm3Transform.set_rotation ROUTE J3Recorder.rotation_changed TO arm3Remote.set_rotation ROUTE handRemoteSensor.rotation_changed TO J4Recorder.set_rotation ROUTE J4Recorder.rotation_changed TO handTransform.set_rotation ROUTE J4Recorder.rotation_changed TO handRemote.set_rotation Viewpoint { position 7.5 10 15 orientation -0.8638 0.4839 0.1402 0.6471 fieldOfView 0.45 description "General" }