Edbot and Edbot Dream

Clive's Blog

Hi. I'm Clive Haworth. I'm the CEO of Robots in Schools and I spend some of my time developing the Edbot Software that lets you code your Edbot and Edbot Dream in Scratch, Python, JavaScript and more.

Motion capture with Scratch 2.0

I wanted to see if it was possible to record the movements of an Edbot in real-time and play them back. I also wanted to do this in Scratch 2.0 to showcase the Edbot Software and see just how far we could go with Scratch.

The result was a project called capture.sb2 which is now included in the Edbot Software as a Scratch sample project. Here's how to use it to create your own motions...

First load up the project in Scratch. Make sure the Edbot Software is configured and running and connected to your Edbot. Run the Scratch script by clicking on the green flag. If everything is working, all the servos on your Edbot should turn on and light up green to indicate they are switched on.


Next thing to do is switch off the servos you want to move. The easiest option here is to switch the arms off. In Scratch, click on each arm servo on the Edbot graphic to turn the servo off. If you select the wrong servo, click again to turn it back on. If you want to move the legs you'll need to get someone to hold the Edbot in position before switching the servos off.

At this point the arm servos on the Edbot should light up red to show they are turned off. You should be able to freely move them. Before you do that, click on the record button (bottom left). This starts the recording process. Now go and SLOWLY run through your motion by moving the Edbot's arms. When you've finished click again on the record button to stop recording.

To replay the motion click on the play button (bottom right). You should see your Edbot playing through the motion you recorded!

So you've now created your motion, but how do you save it or incorporate it into a Scratch project? You have three options.

1. Simply save the Scratch project. Re-open it to play the motion again.

2. Right click on the frame of the motion list. This should display the import / export menu. Choose export to save the data to a text file and import to load a motion from a previously saved text file.

3. The motion list contains of a number of entries. Each entry consists of the number and the angle of every "red" servo at the same point in time. You can copy and paste each entry to a set servo positions block and use the blocks in your Scratch program.


To reproduce the motion exactly you'll also need to use a set servo speed  block to set all servos to 10% and pause between moves for 0.05s using a wait block to reflect the sample rate.

My colleague John has made a seriously cool motion capture video to demonstrate this Scratch project. Why not have a go and capture your own moves!

John CarterComment