;;;; SUMMARY ;; These codes were made for walkin' ;;;; COPYRIGHT ;; Copyright (C) 2006 James P. Steiner ;; All rights reserved. ;; ;; globals [ top clock body oldmy surface altitude dvy linkers greeting? direction-1 direction-2 direction-0 period-0 period-1 period-2 period ] breed [ vectors ] breed [ segments ] turtles-own [ ] segments-own [ vx vy min-angle max-angle phase parent child tag ] patches-own [ ] to startup setup end to setup ca set clock 0 set-default-shape segments limb-shape set-default-shape vectors "line-half" set linkers 3 set period 50 create-segments 1 [ set parent nobody set color who * 30 + limb-color ;; (quick&dirty.. need who-agnostic method) hatch 1 [ set parent myself set color who * 30 + limb-color hatch 1 [ set parent myself set color who * 30 + limb-color hatch 1 [ set parent myself set color who * 30 + limb-color set child nobody set size 0 ] ] set child turtle 2 ] set child turtle 1 ] ;; create shadow leg ;; (hack -- need who-agnostic method) ask segments [ hatch 1 [ set parent turtle (who - 1)] set color gray] create-vectors 1 [ set body self setxy 0 0 set size ( sum [ size ] of segments ) * .75 ] go greeting true end to go every (1 / 30) [ no-display if greeting? != false [ greeting false ] let segs sort-by [ [who] of ?1 < [who] of ?2 ] segments foreach segs [ ask ? [ let s# (who mod (linkers + 1)) ifelse s# = 0 [ setvxy 0 0 ] [ setvxy segx segy ] if s# != linkers [ ifelse s# = who [ set heading new-heading clock ] [ set heading new-heading (clock + 3.6 + symmetry )] if size != .01 + slider "length" [ set size .01 + slider "length" ] ] ] ] if [shape] of turtle 0 != limb-shape [ ask segments [ set shape limb-shape ] ] let bottom -.75 * max-pycor let mx 0 let my 0 let bx 0 let by 0 ifelse attachment = 1 [ set mx mean [ vx ] of segments set my mean [ vy ] of segments set bx 0 - (mx) set by 0 - (my ) ] [ if attachment = 2 or attachment = 3 [ set mx mean [ vx ] of segments set my min [ vy ] of segments let mxy max [ vy ] of segments let span (- my) ;; height from ground to hips let gap abs (bottom + span) ifelse attachment = 2 [ ;; no gravity, snap to bottom set by bottom + span ] [ ;; gravity, accellerate downward ifelse altitude > span [ set dvy dvy - gravity * slow-mo set altitude altitude + dvy ] [ set altitude span set dvy dvy * -0.25 ] set by bottom + altitude ] set bx 0 - mx set oldmy gap ] ] ask segments [ setxy (bx + vx ) ( by + vy ) ] ask body [ setxy [xcor] of turtle 0 [ycor] of turtle 0 set heading 180 + mean-headings turtle 0 turtle (linkers + 1 ) ] if trace? [ ask segments with [ color > gray ] [ pd jump 0.1 jump -0.1 pu ] ] display if time-advance [ set clock clock + speed * slow-mo] ] end to-report segx report [ vx + dx * slider "length" ] of parent end to-report segy report [ vy + dy * slider "length" ] of parent end to-report slider [ name ] report run-result (word name "-" (who mod (linkers + 1) ) ) end to-report new-heading [ freq ] let half-sweep .5 * slider "sweep" let new-head ( slider "angle" + slider "sweep" * (sin ( slider "phase" + freq * period )) ) if who mod (linkers + 1 ) != 0 [ set new-head new-head + [heading] of parent ] report new-head end to-report mean-headings [ a b ] let ha [heading] of a let hb [heading] of b report atan ( .5 * (sin ha + sin hb) ) ( .5 * (cos ha + cos hb) ) end to setvxy [ xx yy ] set vx xx set vy yy end to generate-cycle-parameters-code clear-output foreach [ "angle-0" "sweep-0" "phase-0" "direction-0" "period-0" "length-0" "angle-1" "sweep-1" "phase-1" "direction-1" "period-1" "length-1" "angle-2" "sweep-2" "phase-2" "direction-2" "period-2" "length-2" "speed" "symmetry" ] [ let line-out (word "set " ? " " run-result ? ) output-print line-out ;;; print line-out ] end to movie-prep if movie-status != false [ movie-cancel ] let movie-file user-new-file if movie-file = false [ stop ] let fps user-input "Enter frame-rate" if fps = false [ stop ] movie-set-frame-rate fps movie-start movie-file end to greeting [ show? ] ifelse show? [ ask patch max-pxcor (max-pycor - 1) [ set plabel "Click GO to begin animation." ] set greeting? true ] [ ask patch max-pxcor (max-pycor - 1) [ set plabel "" ] set greeting? false ] end @#$#@#$#@ GRAPHICS-WINDOW 320 67 763 531 15 15 13.97 1 20 1 1 1 0 0 0 1 -15 15 -15 15 1 1 1 ticks CC-WINDOW 5 545 975 640 Command Center 0 BUTTON 707 30 762 63 reset setup NIL 1 T OBSERVER NIL NIL NIL NIL BUTTON 320 29 375 62 G O GO T 1 T OBSERVER NIL NIL NIL NIL SLIDER 10 173 102 206 angle-0 angle-0 -90 270 170 5 1 NIL HORIZONTAL SLIDER 10 207 102 240 sweep-0 sweep-0 0 360 50 1 1 NIL HORIZONTAL SLIDER 10 275 102 308 length-0 length-0 1 10 6 1 1 NIL HORIZONTAL SLIDER 105 173 197 206 angle-1 angle-1 -180 180 -40 1 1 NIL HORIZONTAL SLIDER 105 207 197 240 sweep-1 sweep-1 0 360 40 1 1 NIL HORIZONTAL SLIDER 105 275 197 308 length-1 length-1 1 10 6 1 1 NIL HORIZONTAL SLIDER 200 173 292 206 angle-2 angle-2 -180 180 75 1 1 NIL HORIZONTAL SLIDER 200 207 292 240 sweep-2 sweep-2 0 360 14 1 1 NIL HORIZONTAL SLIDER 200 275 292 308 length-2 length-2 1 10 3 1 1 NIL HORIZONTAL SWITCH 469 29 559 62 trace? trace? 0 1 -1000 SLIDER 10 241 102 274 phase-0 phase-0 -180 180 0 90 1 NIL HORIZONTAL SLIDER 105 241 197 274 phase-1 phase-1 -180 180 -90 45 1 NIL HORIZONTAL SLIDER 200 241 292 274 phase-2 phase-2 -180 180 0 45 1 NIL HORIZONTAL BUTTON 563 29 653 62 clear-traces clear-drawing NIL 1 T OBSERVER NIL NIL NIL NIL SLIDER 128 415 220 448 speed speed 0.01 0.33 0.33 0.01 1 NIL HORIZONTAL CHOOSER 11 108 103 153 limb-shape limb-shape "stick" "knobs" "thick" "solid" "open" "robot" "calipers" 3 SLIDER 105 379 197 412 symmetry symmetry -7.15 7.15 0 0.05 1 NIL HORIZONTAL SWITCH 11 415 126 448 time-advance time-advance 0 1 -1000 BUTTON 200 379 255 412 sym=0 set symmetry 0 NIL 1 T OBSERVER NIL NIL NIL NIL SLIDER 11 454 183 487 attachment attachment 0 3 3 1 1 NIL HORIZONTAL TEXTBOX 189 452 286 512 0 = fixed top\n1 = mean / centroid\n2 = bottom\n3 = bottom + gravity 11 0.0 0 SLIDER 106 120 198 153 limb-color limb-color 5 135 15 10 1 NIL HORIZONTAL SLIDER 11 489 182 522 gravity gravity 0 0.5 0.035 0.0010 1 NIL HORIZONTAL OUTPUT 776 68 966 490 12 BUTTON 776 31 897 64 make preset code generate-cycle-parameters-code NIL 1 T OBSERVER NIL NIL NIL NIL BUTTON 69 46 124 79 Run clear-drawing\nset angle-0 170\nset sweep-0 50\nset phase-0 0\n\nset period-0 50\nset length-0 6\nset angle-1 -40\nset sweep-1 40\nset phase-1 -90\n\nset period-1 50\nset length-1 6\nset angle-2 75\nset sweep-2 14\nset phase-2 0\n\nset period-2 50\nset length-2 3\nset speed 0.33\nset symmetry 0.0 NIL 1 T OBSERVER NIL NIL NIL NIL SLIDER 222 415 314 448 slow-mo slow-mo 0.1 1 1 0.1 1 NIL HORIZONTAL BUTTON 244 46 299 79 Ostritch? set angle-0 140\nset sweep-0 60\nset phase-0 0\nset direction-0 1\nset period-0 50\nset length-0 6\nset angle-1 60\nset sweep-1 60\nset phase-1 135\nset direction-1 1\nset period-1 50\nset length-1 6\nset angle-2 0\nset sweep-2 70\nset phase-2 -45\nset direction-2 1\nset period-2 50\nset length-2 3\nset speed 0.20\nset symmetry 0.0 NIL 1 T OBSERVER NIL NIL NIL NIL BUTTON 11 46 66 79 Walk set angle-0 175\nset sweep-0 25\nset phase-0 0\nset length-0 6\nset period-0 50\nset length-0 6\n\nset angle-1 -25\nset sweep-1 25\nset phase-1 -90\nset period-1 50\n\nset length-1 6\nset angle-2 91\nset sweep-2 5\nset phase-2 45\nset period-2 50\nset length-2 3\n\nset speed 0.2\nset symmetry 0\nclear-drawing NIL 1 T OBSERVER NIL NIL NIL NIL BUTTON 127 46 182 79 March set angle-0 200\nset sweep-0 35\nset phase-0 0\n\nset period-0 50\nset length-0 6\nset angle-1 -60\nset sweep-1 60\nset phase-1 180\n\nset period-1 50\nset length-1 6\nset angle-2 101\nset sweep-2 0\nset phase-2 90\n\nset period-2 50\nset length-2 3\nset speed 0.22\nset symmetry 0\nclear-drawing NIL 1 T OBSERVER NIL NIL NIL NIL TEXTBOX 12 10 276 40 Choose a preset, or manually adjust the locomotion geometry. Changes take effect immediately. 11 0.0 0 TEXTBOX 13 155 123 173 Limb Motion Geometry 11 0.0 0 TEXTBOX 12 89 80 107 Appearance 11 0.0 0 TEXTBOX 320 10 470 28 Click GO to animate the limbs 11 0.0 0 TEXTBOX 12 397 102 415 pauses animation 11 0.0 0 BUTTON 186 46 241 79 Retreat set angle-0 200\nset sweep-0 35\nset phase-0 0\n\nset period-0 50\nset length-0 6\nset angle-1 -60\nset sweep-1 60\nset phase-1 135\n\nset period-1 50\nset length-1 6\nset angle-2 101\nset sweep-2 0\nset phase-2 90\n\nset period-2 50\nset length-2 3\nset speed 0.22\nset symmetry 0.0 NIL 1 T OBSERVER NIL NIL NIL NIL BUTTON 186 82 299 115 quarduped (cat) front cd\nset angle-0 140\nset sweep-0 37\nset phase-0 0\nset direction-0 1\nset period-0 50\nset length-0 6\nset angle-1 60\nset sweep-1 33\nset phase-1 135\nset direction-1 1\nset period-1 50\nset length-1 6\nset angle-2 12\nset sweep-2 56\nset phase-2 -45\nset direction-2 1\nset period-2 50\nset length-2 3\nset speed 0.2\nset symmetry 0.0 NIL 1 T OBSERVER NIL NIL NIL NIL @#$#@#$#@ = WHAT IS IT = A tool to explore bipedal locomotion as a product of simple pendulum-like motion A demonsration of procedureal animation (vs. motion-capture or hand-animated) Connected amatures are made to swing at selected frequencies and phases, generating movement cycles that suggest running, walking, swimming, and the like. @#$#@#$#@ default true 0 Polygon -7500403 true true 150 5 40 250 150 205 260 250 calipers true 5 Polygon -10899396 true true 135 -150 150 -165 180 -150 150 -135 165 75 195 90 210 105 225 135 225 165 210 195 195 210 165 225 135 225 105 210 90 195 75 165 75 135 90 105 105 90 135 75 165 75 165 90 150 120 135 90 105 105 90 135 90 165 105 195 135 210 165 210 195 195 210 165 210 135 195 105 165 90 165 75 135 75 150 -135 knobs true 5 Circle -10899396 true true 120 120 60 Line -10899396 true 150 150 150 -150 line true 0 Line -7500403 true 150 0 150 300 line-half true 5 Line -10899396 true 150 -150 150 150 link true 0 Line -7500403 true 150 0 150 300 link direction true 0 Line -7500403 true 150 150 30 225 Line -7500403 true 150 150 270 225 open true 5 Polygon -10899396 true true 195 150 165 195 135 195 105 150 120 -120 135 -165 165 -165 180 -120 195 150 180 150 165 -150 135 -150 120 150 135 180 165 180 180 150 robot true 5 Polygon -10899396 true true 90 105 135 -150 135 -165 165 -165 165 -150 210 105 180 195 120 195 90 105 195 105 165 -135 135 -135 105 105 solid true 5 Polygon -10899396 true true 120 -150 135 -165 165 -165 180 -150 195 135 195 165 165 195 135 195 105 165 105 135 stick true 5 Line -10899396 true 150 -150 150 150 thick true 5 Polygon -10899396 true true 150 -150 165 -135 165 165 135 165 135 120 @#$#@#$#@ NetLogo 4.0.4 @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ default 0.0 -0.2 0 0.0 1.0 0.0 1 1.0 0.0 0.2 0 0.0 1.0 link direction true 0 Line -7500403 true 150 150 90 180 Line -7500403 true 150 150 210 180 @#$#@#$#@