Happy New Year! I hope that those of you who celebrate at this time of year, were able to take a nice, relaxing break. I certainly did. :-)
Anyway, it’s now time for me to ease back into work. But rather than it being an abrupt transition, I’ve decided to take a look at a pet project that I thought would be pretty fun: controlling robots from inside AutoCAD. The thinking is to outline some possibilities for moving virtual robots inside a floorplan drawing and having their real-world, physical counterparts move as instructed. Perhaps along a specific path, perhaps by finding a path based on the current 2D floorplan… we’ll see what makes most sense as we go along.
But let’s start with the basics, such as which robots to use. In the Walmsley household we had a number of them under the tree, this Christmas: I bought a Sphero BB-8 and my wife bought a LEGO Mindstorms EV3 construction system, both ostensibly “for the kids”. Thankfully it seems I’m also covered by that particular description, so I get to mess around with them now that the actual kids are back in their respective classrooms.
I haven’t cracked open the EV3 set, as yet, but we already had a lot of fun with BB-8, over the break. For those of you who missed the fuss, this is the “real” BB-8 from Star Wars: The Force Awakens:
The Sphero version of BB-8 is pretty darn cool. Here’s the marketing video:
When getting started, this post helped quite a bit, as well as this one it points to. To simplify the act of getting BB-8 to work, I also integrated keyboard support into my Cylon code using this snippet.
And here’s the code in action. I cycle through a sequence of four commands – front, left, right, backwards – and as the robots are facing in opposite directions they end up in the same place.
To make this work I applied different durations for the “roll” operations for each type of robot: given its design, the Ollie is somewhat grippier and more responsive, so I used a roll duration of 600ms vs. 1.5 seconds for BB-8.