Last week President Obama played with a Sphero. This weekend you can win up to $5,000 at the Sphero Hackathon in Boulder. It starts Friday May 4th at 6pm with a Welcome Reception (which means beer and Spheros) and runs all day Saturday and Sunday where you can hack with Spheros and the Orbotix SDK. I’ll be around Sunday from 1pm to 3pm taking a look at what people have done, playing around with the apps, and answering any questions about why I think Sphero (and Orbotix – the company that makes Sphero) is so awesome.
Two new apps have recently come out for the Sphero. The first, Chromo, allows you to play with Sphero in a whole new way. While Orbotix’s other apps allow you to control Sphero from your device (kinetically and via a digital joystick), now Sphero is the controller. The video tells the story better than words.
The other app is MacroLab. Did you have a Big Trak as a kid? If not, you missed out, but you can relive those missed moments with MacroLab. As before, let’s start with a quick video.
MacroLab is a tool Orbotix developed for internal purposes that turned out to be so powerful they decided to make it available to all Sphero users. It is essentially a high level abstraction of the API that runs in the ball’s memory that commands the robot. It makes the API accessible to people who don’t know how to program an iOS or Android app.
When a user creates a macro they send a series of commands to the ball. Macros are made by stringing together 27 basic commands (by comparison the SDK has about 300 commands – most are UI/robot housekeeping based but 100 are ball control related). Each command is executed in sequence. Following is an example (called “test”) along with an explanation.
- Calibrate – this zeros out Sphero’s heading so you know which way he will go after you aim him
- RGB – this changes the color of the LED to purple – the numbers are the RGB settings
- Roll 0.5 0 0 – 50% speed (0.5), 0º heading = straight ahead, 0 second wait time before executing next command
If we stopped here the LED will flash purple and Sphero would run away at 50% speed and only stop when you exit the macro. Basically the macro runs for a fraction of a second with an open ended roll command. The Sphero goes white (his default color) after the macro is run. In order to not have an open ended command we need to add some more stuff.
- Delay 5000 – this means to wait for 5 seconds, Sphero uses milliseconds so 5000ms = 5 seconds
- Roll 0.0 0 0 – 0% speed (0.0), 0º heading, 0 second delay
- RGB – change LED color to orange
- Delay 1000 – Wait for 1 second
The entire macro runs for 6 seconds. Sphero will turn purple, drive for 5 seconds at 50% speed, stop, turn orange for one second and then end by turning white.
The commands for MacroLab are very basic but powerful enough that Orbotix uses them to run tests on the factory line and form the basis of programs like “Draw N Drive” (every line you draw gets converted to a macro and the ball executes the command). The complete command list follows:
- Roll – sets the ball in motion
- RGB – changes the main LED color
- Calibrate – zeros heading
- Delay – wait time in ms before executing next command
- Fade – fade between two colors over a set period of time
- Back LED – turn the blue aiming LED on/off
- WaitUntilStop – don’t execute the next command until Sphero has stopped moving
- Rotate Over Time – turn xº in y seconds
- SD1, SD2 – global variables for system delays – useful when you want a bunch of commands to use the same delay
- SPD1, SPD2 – global variables for ball speeds – useful when you want a bunch of roll commands all at the same speed
- Roll SD1, SPD1 – roll command that uses the system SD1 for delay and SPD1 for speed
- Roll SD1, SPD2 – roll command that uses the SD1 for delay and SPD2 for speed
- RGB SD2 – change LED to RGB setting but use SD2 delay time for duration
- Rotate Over TIme SD1, SD2 – rotate over time command but uses the system delays SD1 and SD2 respectively
- Goto – calls another macro or restarts the same macro
- Rotation Rate – set how fast the ball can turn
- Stabilization – turns the control system on and off -when off the robot will not move inside the ball
- Raw Motor – command the motors without any control system enabled
- EMIT – Displays a message on the phone when the ball hits that point in the macro – useful for debugging
- Sleep – Puts Sphero to sleep
- Loop For, End – Create loops within the macro
- Comment – ability to add comments to your macros – no effect on the ball
When I first heard the idea for MacroLab I smiled a huge smile. It’s the beginning of Orbotix opening up their robot control language, which is part of the magic behind the premise for our investment in Orbotix. I’m amused when people say “why did you invest in a toy ball company?” when what we really invested in was a bunch of geniuses working on a robotic operating system that happens to start life out as a robot ball that you control with your smartphone.
What are you waiting for? Buy a Sphero today and get started. And come to the Sphero Hackathon in Boulder this weekend.