BB-8, node bots and the world of connected robots

Submitted by davidseth on Tue, 22/Sep/2015 - 09:50

BB-8, node bots and the world of connected robots

BB8 robot

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.

It took some searching to find a few other souls also trying the same. I came across the great cylon.js community and one pioneer in particular who created some BB-8 code that worked with cylon.js.

Command line

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.

Simply typing:

'nvm use 0.12.7'

would instantly switch the console session to the older version of node.

VoilĂ . All good. A simple re-build:

'npm rebuild'

and I was in business.

'node bb8.js'

bb8 lights up from command line via cylon.js

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.

The Web

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.

cylon browser UI
All the functions are enumerated into Commands (see dropdown).

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 :)

Cylon

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.

Cool.

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.

Add new comment

*

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.