Closed jhlau closed 8 years ago
I tried to test the collision detection as well and had to tweak the configuration thresholds in order to get events...
bb8.configureCollisions({
meth: 0x01,
xt: 0x20,
yt: 0x20,
xs: 0x20,
ys: 0x20,
dead: 0x50
});
bb8.on("collision", function(err, data) {
if (err) {
console.log(err);
} else {
console.log("collision detected!");
}
});
...those thresholds might be a little bit too sensitive but you should be able to test it.
This makes me wonder if we should add additional key to indicate "preset" defaults per device. For example:
robot.configureCollisions({device: "bb8"});
which would then use default values such as those used by @olcar vs. the current defaults which are optimized for Sphero 2.0 devices.
What do you think?
That would make sense. I wasn't really able to find the sweet spot for BB8, it probably needs further investigation but those settings might be a good starting point. Defining presets would definitely help us improve that as a community.
If I understand correctly, that means BB8 is not a Sphero 2.0 device and handles behaviours in a different manner?
If it's the case, what do you think about defining global device presets for other defaults settings like RotationRate, InactivityTimeout, etc. ?
Most of these settings are the same, but the collision detection is one I've noticed a clear difference.
Anyhow, we'd love a PR that added this, or else I can work on it.
OK, let's start with collision detection presets for BB8 then ;)
I can try to work it out during the weekend.
Awesome! :bow:
I spent some time fiddling with the thresholds yesterday. I find that anything larger than 01h for 'dead' makes it very insensitive. I am currently using these thresholds:
xt: 0x20,
yt: 0x20,
xs: 0x10,
ys: 0x10,
dead: 0x01
It's a little sensitive though. I'd get multiple collision events for a collision, and also events for rotating BB8 (in-place).
Oh yes, for the output, undefined values are returned for xMagnitud, yMagnitud, speed and timeStamp.
Any updates on this?
I submitted a PR yesterday that was merged earlier today to add presets for BB8.
Can you test again on your side using the new example I added (collision-detection-bb8.js)?
Let me know if it works OK for you.
The new 0.7.0 release includes this new code.
Yeap. Tested it a bit and it's working. It occasionally fails to detect some collision, but I think it's good enough.
Quick question - do the other SDKs have these sort of threshold values for BB8? I'd imagine it'd make sense to copy their threshold values.
Hi, @jhlau I looked thru the other SDKs and was not able to find any specific default values per type of device. I suppose that means it is up to us to do so! :smile:
@jhlau if you need further assist on this issue, please re-open it. Thanks again to you and to @olcar for the code!
Hi,
I was just testing with collision detection and I am not getting asynchronous messages when BB-8 has a collision. Has anyone tested if it works? I added a line to tell it to roll in the examples/collision-detection.js:
No colour change, no console log output.
I am running on Ubuntu 14.04, nodejs = 0.10.25 and BB-8's firmware = 4.63.