sphero-inc / sphero.js

🚫 DEPRECATED: The Sphero JavaScript SDK to control Sphero robots.

Home Page:http://sdk.sphero.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Possible to control BB8 Head?

mobyjames opened this issue · comments

I was able to connect and control bb8 using standard commands, but am I correct in assuming that controlling the head is not supported? I'd be happy to investigate how to add it if someone could point me in the right direction. Is there a way to interface the motors directly?

The head is directly attached to the motor that drives the weight through a magnet mounted to a fixed stock - it is not a separate component you'd drive on its own.

This may help clarify things:

http://www.element14.com/community/blogs/linker/2015/09/16/disassembling-bb8-part-1

Oh, perfect. Thanks for the clarification.

@mobyjames did you get any code to move the head working?
i am trying to force bb8 to say YES but i am not able. I tried different combinations of roll and stop with no luck. Don't know if there is other functions to move the magnets inside for example. Thanks!

As mentioned above, the head is not directly controlled. To get a fast nod / yes, I use the following (node.js):

var src = "motor 2 80 2 80\n" +
          "delay 50\n" +
          "motor 1 80 1 80\n" +
          "delay 50\n" +
          "motor 2 80 2 80\n" +
          "delay 50\n" +
          "motor 1 80 1 80\n" +
          "delay 50\n" +
          "motor 0 0 0 0\n";

actions['fast_nod'] = macros.compile(src);

Hi @mobyjames, thank you very much for your help.
Following your sample I got YES working without macros like this:

opts = {lmode: 2, lpower: 80, rmode: 2, rpower: 80};
bb8.setRawMotors(opts, function() { });
setTimeout(function() { opts = {lmode: 1, lpower: 80, rmode: 1, rpower: 80}; bb8.setRawMotors(opts, function() { }); }, 100);
setTimeout(function() { opts = {lmode: 2, lpower: 80, rmode: 2, rpower: 80}; bb8.setRawMotors(opts, function() { }); }, 200);
setTimeout(function() { opts = {lmode: 1, lpower: 80, rmode: 1, rpower: 80}; bb8.setRawMotors(opts, function() { }); }, 300);
setTimeout(function() { opts = {lmode: 0, lpower:  0, rmode: 0, rpower:  0}; bb8.setRawMotors(opts, function() { }); bb8.setStabilization(1, function() { }); }, 400);

And NO like this:

bb8.roll(0,45);
setTimeout(function() { bb8.roll(0,315); }, 200);
setTimeout(function() { bb8.roll(0,45); }, 400);
setTimeout(function() { bb8.roll(0,315); }, 600);
setTimeout(function() { bb8.roll(0,45); }, 400);
setTimeout(function() { bb8.roll(0,315); }, 600);
setTimeout(function() { bb8.roll(0,0); }, 800);