mintuz / BB8-Commander

A Node CLI Tool for the Sphero BB8 Robot every loves.
MIT License
70 stars 17 forks source link

[IDEA] Has anyone played with Collision Detection? #23

Open saraford opened 8 years ago

saraford commented 8 years ago

Hey all,

I've noticed the collision detection is hit or miss. I've followed this Issue to tweak the sensitivity, but it is unreliable. I can pick up BB-8 and a collision is detected. But BB-8 can run into a wall and lose its head and no collision detected. Seems that the collision has to be at a certain spot on the ball.

Curious if anyone else has tried to play with collision detection.

Here's my code:

module.exports = function (bb8) {

  console.log("Waiting for a collision");

  bb8.detectCollisions();
  bb8.color("green");

  bb8.configureCollisions({
    meth: 0x01,
    xt: 0x20,
    yt: 0x20,
    xs: 0x20,
    ys: 0x20,
    dead: 0x50
  });

  bb8.on("collision", function(data) {
     console.log("collision detected");
     console.log("  data:", data);

     bb8.color("red");

     setTimeout(function() { bb8.color("green"); }, 1000);
  });

  bb8.roll(200, 0);
}
Sud-Puth commented 8 years ago

Hi Sara,

I tried to play with the collision detection when I was working on the drive mode and I too echo your thoughts that the detection is unreliable. It can be added as a fun feature but I guess cannot be taken for granted.

On Jul 22, 2016 9:56 PM, "Sara Ford" notifications@github.com wrote:

Hey all,

I've noticed the collision detection is hit or miss. I've followed this Issue to tweak the sensitivity https://github.com/orbotix/sphero.js/issues/48, but it is unreliable. I can pick up BB-8 and a collision is detected. But BB-8 can run into a wall and lose its head and no collision detected. Seems that the collision has to be at a certain spot on the ball.

Curious if anyone else has tried to play with collision detection.

Here's my code:

module.exports = function (bb8) {

console.log("Waiting for a collision");

bb8.detectCollisions(); bb8.color("green");

bb8.configureCollisions({ meth: 0x01, xt: 0x20, yt: 0x20, xs: 0x20, ys: 0x20, dead: 0x50 });

bb8.on("collision", function(data) { console.log("collision detected"); console.log(" data:", data);

 bb8.color("red");

 setTimeout(function() { bb8.color("green"); }, 1000);

});

bb8.roll(200, 0); }

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mintuz/BB8-Commander/issues/23, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJcu9mkNirIzN3rqUAXhft3lclQYaQkks5qYXSsgaJpZM4JTQT1 .

saraford commented 8 years ago

@Sud-Puth Thanks for the response! I tried adjusting the configureCollisions sensitivity to what I'm guessing is the lowest levels and still can't detect a collision. I'll ask on the Sphero repo if no one here has figured it out. Thanks!

clodio commented 6 years ago

I just play with sphero edu app and i have the same problem coollision detection not working