BB-8, node bots and the world of connected robots
I was fortunate enough to get a BB-8 for father's day. My wife and four kids really know me well. It's a blast to play. The native app allows for full control as well as some other fun things like recording messages and playing them back as a "hologram". There is a guard mode but it really isn't too smart, it just randomly goes around without any real sense of anything. Just bumping around like a pinball.
My kids and I played with it most of the afternoon. While they were having a turn (very short turns!) I did some quick searches on the net to see how hackable the BB-8 was. I knew that it was communicating via BLE so it had to be controllable from a computer. Well, at least that was what I thought.
Did it work? No. Well, not out of the box. It took me days to get it to even light up (with an error). Now, most of this was probably due to learning cylon.js library as well as debugging node.js problems on my mac. I could not for the life of me get anything to work with node v4 and had to go back to v.12. I quickly found 'nvm' to be the key to perform this magic trick.
'nvm use 0.12.7'
would instantly switch the console session to the older version of node.
Voilà. All good. A simple re-build:
and I was in business.
My BB-8 was blue!. I know this is so basic but after a few days of effort I felt I had just discovered the 8th wonder of the world.
Now I wanted to up my game. I had been reading that cylon also includes a built in web interface allowing for remote control via a nice UI. To do this I added the http server then decorated the robot object with a few functions. This is discovered by cylon, which promptly builds a nice UI.
In the above image you can also see some helper commands via cURL as well as the functions that are exposed.
Now I could control my robot by quickly selecting a command and clicking 'RUN'. Having a web connected robot with a REST API opens up the possibility of integrating my BB-8 with essentially anything!
I have put some functional (let me stress the *functional* part) code up on my github account. Please don't expect much and I promise you won't be disappointed :)
I was impressed with cylon. It has the ability to glue over 40 different platforms together. These platforms range from Arduino, Sphero, Edison to software systems such as speech recognition and OpenCV.
The fact that it is built on node brings so much more, HTTP built in, huge numbers of existing libraries that are easy to integrate and a massive development community that keeps driving things at a breakneck pace.
The learning curve for cylon was actually quite small. The reason I had so many issues was mainly around node itself and package dependancies. Once that was overcome I went from being a newb to controlling my BB-8 over the web in 2 days.
What do you think?
What are your thoughts on BB-8, cylon, robots? I would love to hear your opinion or get some feedback so please add a comment or drop me a line on Twitter: @davidseth.