This project is aimed at creating a more familiar way for users to control a Sphero Robot. Using an Xbox One controller, the Sphero JavaScript SDK, and Node.js, the goal is to enable full-on control of the Sphero Robot's movement and various functionalities (such as changing color and "tricks") through a typical gamepad. More details to come in the future!
Some libraries you'll need to npm install:
gamepad-plus
keypress
sphero
Week 1This week was mostly about just hooking up my laptop to the Sphero and planning out what I would like to have available to the user via the XB1 controller (there is some basic code but not much). A controller clearly doesn't have as much input as a keyboard - with this in mind, I plan to use things like the d-pad to cycle through colors of the Sphero. I'd also like to map speed [de]acceleration to the left/right triggers. For now, enjoy a picture of Meep the Sphero Robot chilling next to my laptop!
This week I was able to start playing with more colors (hooray)! I'm also getting things set up to use a gamepad - while the latter isn't pushed to my Github repository yet, being able to cycle through approximately 30 colors with the A/D keys is. I'm aiming to have the XB1 controller connecting to the project by next week and to have a diagram to share with what buttons on the gamepad will map to what functions on the Sphero, so please look forward to that. In the meantime, have a picture of Meep after hours!
This week, I am fortunate enough to have a diagram [WIP] to share! I'm still working on getting the gamepad working so I have not added that to my project. However, I am looking into adding more tricks/functions to the unmapped keys.
I've began support for the gamepad! There's not much yet in terms of anything working yet, but you can see in the repository that controller support has started. The hope is that the XB1 will be detected as a standard USB controller given driver support. In the instance this is not the case, there'll need to be a little extra legwork done to make sure the XB1 controller is compatible with Nodejs. I'll be continuing to work on it for this week with hopes of having everything smoothed out by time I post my Week 5 update - please look forward to it!
Week 5This week has really just been a continuation of last week – working on the gamepad (specifically, the XB1 controller) working with the Sphero. I’ve been running demos of gamepad libraries and tests to keep trying to find what will eventually click with the XB1 controller. There are some hacky methods, but that’s half the fun!
Project recap - Sphero Drive, while being in a less favorable state than I’d prefer, has been a really fun project. At the start, I had zero experience with Node.js and only very basic experience with JavaScript. My main challenge came down to Xbox One controller support in Node.js and managing my time. Unfortunately there just isn’t enough support quite yet for the XB1 controller to work well with the project – it is detected and it sends input, but not the right input. Given the opportunity to expand on this project more, I would most likely develop a Node.js library that supports the XB1 controller. For now, keyboard input exists and it will also log the interpreted input of the XB1 controller.
Comments