Posted   —   № 34

Using Scratch to Make out Robot Sing and Dance

Dr Alexander Enoch (Sandy) designed and created Marty, during his PhD at The University of Edinburgh. Now the founder of educational robotics company, Robotical, Sandy chooses to use Scratch to teach programming with Marty. Using the Marty Scratch extension, children can create code to make Marty dance, kick, walk, slide, shake their hand, react to the environment or break out into moves they design themselves!

Sandy and school children

Why Scratch?

Sandy and the team at Robotical designed Marty to be a versatile, educational robot rather than just a novelty toy. “With Marty, we’ve always tried to use real programming environments rather than inventing our own proprietary ones” Sandy explains, “Although Scratch is not a production language it was developed by MIT and it’s become the most popular block based coding language for a reason - it’s great! After mastering the concepts of coding with Scratch, Marty’s users can then go on to use Python, Javascript and ROS to program him, but for teachers and schools it is essential that we are compatible with Scratch”.

Another reason the developers at Robotical favoured Scratch was its familiarity amongst teachers worldwide and ease of use. “The idea of teaching programming can be very daunting for teachers that don’t specialise in this field” Sandy explains, “so we wanted to give them as much familiarity as possible. Since Scratch is used in primary and secondary schools throughout the UK, it seemed like the obvious solution”.

The choice to use Scratch has proved a good one, especially when Robotical take Marty to education events. At the Scottish Learning Festival teachers would see Marty dancing and come over for a closer look, but it was when they saw the familiar Scratch interface that they got really serious about using Marty in their classrooms.

Sandy and school children

Great for robots… and their programmers!

Scratch isn’t just great from an education perspective. It’s design and implementation make it possible for Marty’s users to be truly creative and learn some advanced concepts in computational thinking while having fun. “The whole platform is well thought out” according to Sandy, “It can be used to do some pretty funky things like running different sections of code in parallel, which we can use to simplify coding and help explain real-time issues, and the graphical area is great to play with. We can use the graphics area to show things like graphs of sensor readings, or to make a Marty avatar react to tilt sensed by the accelerometer on the real Marty. It’s a lot of fun”.

Sandy and school children

Developing the Scratch Extension

After making the call to use ScratchX and go web-based with their extension the developers at Robotical were pleased with how relatively straightforward the process was. “Speaking to devices over the local network from within a web browser can be interesting” explains Sandy. “We wrote a general javascript library for Marty, which is actually used behind the scenes in our app and our other web-based setup and calibration tools. Once we had that it was pretty easy to create the Scratch extensions. Later on we made a couple of variants: one that allows you to control Marty directly over Marty’s setup WiFi - which can be handy if you’re out and about with your Marty; and another that sends commands to multiple Martys at once, which is great for synchronised dances!”

Sandy and school children

To Scratch3… and Beyond!

Sandy and his team have already produced a version of their Scratch extension for Marty in Scratch3 and are hugely looking forward to its January launch. Sandy goes on to highlight certain aspects of Scratch3 that he is particularly excited about: “From a portability standpoint the move away from Flash is a big deal, that’s what really lets it work on the iPad, but also on nearly any phone or other modern web-enabled device. The interface is a lot cleaner, and extensions are no longer considered experimental features, which is nice”.

It is clear from the enthusiasm with which Sandy talks about Scratch that he is sure he made the right decision when he chose to use it with Marty. When taking Marty to schools and events the Robotical team find that kids just jump straight in to programming due to Scratch’s intuitive interface. “At a recent museum event we had kids coming over and spending 45 minutes programming Marty to dance and interact with them” Sandy smiles, “they were completely absorbed, even when surrounded by all the other impressive museum exhibits!”.