DIY Walkers
  • Home
  • Walker ABC's
  • Build Instructions
    • TrotBot Builds >
      • TrotBot Linkage Plans
      • TrotBot's Legs Simplified
      • Quadruped TrotBot
      • Hexapod TrotBot
      • TrotBot
      • TrotBot, Ver 3
      • Mindstorms TrotBot, Ver 3
      • Wooden TrotBots by Automata Korea Design
      • 3D Printed TrotBot by Scott Anderson
      • Mindstorms TrotBot, Ver 2
      • Mindstorms TrotBot
      • Large-Scale TrotBot
    • Strider Builds >
      • Strider Linkage Plans
      • Strider Ver 3's Legs
      • Strider Ver 3's Frame
      • Mindstorms Strider Ver 3 Mod
      • Strider
      • Strider's Legs Simplified (ver 2's)
      • RC Strider
    • Mechanical Spider >
      • Klann Mechanical Spider - Climbing Mod
      • Klann's Spider, EV3 Long Legs
      • Klann High-Step Mod
      • Klann's Spider, Ver 2
      • Mindstorms Klann
      • Klann's Spider, Ver 1
      • Klann's Linkage Plans
    • Strandbeest
    • LEGO Spot Micro
    • Linkage Warm Ups >
      • Lever Paradox
      • LEGO Biters
      • LEGO Punchers (4 bar linkage warm-up)
      • LEGO Hopping Robot
    • Hiro Labo
    • Whegs (wheel-legs)
  • Customize
    • Strider Linkage Optimizer
    • Klann Linkage Optimizer
    • Strandbeest Optimizer for LEGO
    • TrotBot Optimizer
    • 4 Bar Linkage Optimizer
    • 4 Bar Walking Linkage
    • 6 Bar Walking Linkage
  • Linkage Simulation
    • Python Linkage Simulator
    • Scratch Linkage Simulator
  • Blog

Animating Linkages with Scratch 

Here's a video of TrotBot simulated in Scratch, and an embedded simulator is below.
Picture
Non-LEGO TrotBot with bar B7=2.83. Note: if B7 were connected to the crank its length would need to be 3.
If you look at the Scratch code you'll see that the linkage's bars aren't sprites nor are they a series of images like the frames of a movie since this wouldn't allow the bar lengths to be changed while running the code.  Instead, they are drawn with Scratch's pen, using the dimensions you set with the slider bars, and the pen's lines are erased and re-drawn each time an arrow key is pressed. The same goes for the red dots of the joints and the foot-paths that we added to some linkages, like the images of Strider below.  

If you want to graph a linkage's foot-path or horizontal foot-speed, then open the project on MIT's  site, click  "see inside" and follow the steps in the images below.  Note: you can access joint and bar maps by pressing "1" or "2" on your keyboard.
Picture
Picture
The horizontal speed of the feet when in contact with the ground can be calculated every 5 degrees of crank rotation as follows:                    
Foot-Speed (c​rank at x degrees) = Foot's X position(crank at x degrees) - Foot's X position(crank at x-5 degrees)
​

​For an easier linkage simulation in Scratch check out the 4-Bar Linkage. 

Below is the embedded simulator which is started by clicking the green flag.  You can also run them on MIT's site where you can modify the Scratch code.
 
After changing a bar's length, click somewhere other than a slider bar and then press the space bar to see the new linkage and foot-path, and use your keyboard's left/right arrows to rotate the crank.

​​
​The algorithms, and how we used them to simulate linkages, are described here.

Scratch is also made for creating games, so here's TrotBot Goalie.

To play, click the green flag below to load TrotBot and launch the balls you need to block.  Press left arrow to walk left, right arrow to walk right, "z" to jump left, "x" to jump right.

​For other Scratch coding examples check out the games below  (not linkage related).
​
​​Halo Elite Sword fight
​Gold Elite:  D - walk right,   A - walk left,  W - Jump,  S - swing sword,   X - duck
Red Elite:  6 - walk right,  4 - walk left,  8 - Jump,  5 - swing sword,  2 - duck

​
​
Asteroid Belter
​​Avoid asteroids with the keyboard's arrows (up,down, left and right). The spaceship steers via Newton's 3rd law (like planes and rockets), where a force perpendicular to the rocket's direction causes it to slowly accelerate in the direction of the force, and the turn will continue accelerating if the arrow key is held down.   


​Gravity Pong
Left Player:  A moves paddle down, Q moves paddle up
Right Player:  control paddle with up/down arrows
​Modify the game by adjusting the force of Gravity, and the Level of difficulty.

Halo 3D Tanks
Left Tank:  
​Left hand for moving tank:  w=in,  s=out,  a=left,  d=right
Right hand for shooting:  y=gun up,  g=gun down,   j,k,l fires 1 shell each

Right Tank:
​Left hand for moving tank with 4 arrow keys
Right hand for shooting:  8=gun up,  4=gun down,   9,6,3 fires 1 shell each

Piranha
​​Avoid the piranhas by directing the diver with your mouse.
  • Home
  • Walker ABC's
  • Build Instructions
    • TrotBot Builds >
      • TrotBot Linkage Plans
      • TrotBot's Legs Simplified
      • Quadruped TrotBot
      • Hexapod TrotBot
      • TrotBot
      • TrotBot, Ver 3
      • Mindstorms TrotBot, Ver 3
      • Wooden TrotBots by Automata Korea Design
      • 3D Printed TrotBot by Scott Anderson
      • Mindstorms TrotBot, Ver 2
      • Mindstorms TrotBot
      • Large-Scale TrotBot
    • Strider Builds >
      • Strider Linkage Plans
      • Strider Ver 3's Legs
      • Strider Ver 3's Frame
      • Mindstorms Strider Ver 3 Mod
      • Strider
      • Strider's Legs Simplified (ver 2's)
      • RC Strider
    • Mechanical Spider >
      • Klann Mechanical Spider - Climbing Mod
      • Klann's Spider, EV3 Long Legs
      • Klann High-Step Mod
      • Klann's Spider, Ver 2
      • Mindstorms Klann
      • Klann's Spider, Ver 1
      • Klann's Linkage Plans
    • Strandbeest
    • LEGO Spot Micro
    • Linkage Warm Ups >
      • Lever Paradox
      • LEGO Biters
      • LEGO Punchers (4 bar linkage warm-up)
      • LEGO Hopping Robot
    • Hiro Labo
    • Whegs (wheel-legs)
  • Customize
    • Strider Linkage Optimizer
    • Klann Linkage Optimizer
    • Strandbeest Optimizer for LEGO
    • TrotBot Optimizer
    • 4 Bar Linkage Optimizer
    • 4 Bar Walking Linkage
    • 6 Bar Walking Linkage
  • Linkage Simulation
    • Python Linkage Simulator
    • Scratch Linkage Simulator
  • Blog