In one of my previous posts, I discussed how Anki improved the user experience with the Cozmo robot by designing the Scratch based Code Lab experience. The ability to program Cozmo with Scratch made Cozmo a great tool for learning both robotics and programming.
Petoi Coding Blocks
I am happy to see Petoi make great progress on a similar initiative. Petoi, the maker of the Nybble and Bittle robots now has a new tool called Petoi Coding Blocks. Petoi Coding Blocks allows you to easily program Bittle using Scratch. While a previous Scratch interface was available via TinkerGen, the Petoi Coding Blocks is way easier to install and much easier to use. The instructions at Petoi worked for me on a Windows system without any hiccups. The steps work on an out-of-the-box Bittle 2.0, although you might want to update the firmware if you want to read from or write to the analog/digital pin (which may be useful for reading values from installed sensors)
Building New Skills
Petoi Coding Blocks is self sufficient to program Bittle to perform new skills. Teaching Bittle a new skill (such as climbing steps) would need you to program a precise and coordinated movement of the joints, which essentially means asking Bittle to quickly move from one frame to the next frame. Coding blocks provides a block called “Transform to frame” to accomplish this. The challenging part is to come up with the correct angles for the joints. Petoi has a handy guide for skill creation, and also another as well as a skill composer too which lets you play with different joint angles with the robot and formulate a skill.
Translation to Python
Another bonus feature in Petoi Coding Blocks is that it translates the Scratch program into Python and shows you the Python code. This feature is extremely valuable if you (or your child) is migrating from a block based programming language like Scratch to Python. You can also copy the Python program and directly execute it using the Python Serial API. This feature can also help you write simple programs using Scratch, translate it to Python, and then modify the program in Python if you want to integrate with other libraries which are not provided with Scratch. As an example, if I wanted to write a program to make the Petoi Bittle and Anki Vector robots dance together (tutorial on that coming soon), I would use the Petoi Python Serial API to program Bittle and the Anki Vector SDK to program the Vector robot. It helps that both libraries are in Python, and so code and be interleaved to make the two robots dance in sync.
Demo
I created a short demo on how you might want to use Petoi Coding Blocks and program Bittle to quickly perform some of its existing skills. Please enjoy the video below.
Petoi Coding Blocks is definitely a new tool to begin programming the Bittle. What it lacks though are good open source examples that others can build on (Petoi has a small list of programs on their Github). We hope that the Petoi community can build on this, and this tool grows and evolves to get kids (and adults) enthusiastic about programming and robots. If you have tried Petoi Coding Blocks, we would love to see your feedback in comments below.