Skip to content

Potential bugs in collision detection #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
SJ-Fang23 opened this issue Oct 29, 2023 · 3 comments
Open

Potential bugs in collision detection #41

SJ-Fang23 opened this issue Oct 29, 2023 · 3 comments

Comments

@SJ-Fang23
Copy link

Hi, the on_collision method doesn't seem to function properly.
It was giving

"spherov2/commands/sensor.py", line 117, in __collision_detected_notify_helper
unpacked = struct.unpack('>3hB3hBL', packet.data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
struct.error: unpack requires a buffer of 18 bytes

I changed it to ">3hB3hBh" and everything works again.

@SJ-Fang23
Copy link
Author

I was using Sphero Bolt.

@XbzOnGit
Copy link

I met with the same problem and made the following modifications.

# 2 * (3 * 2 + 1) + 4 = 18.  
if(len(packet.data) < 18):
            packet = packet._replace(data=bytearray(18))

This also works.

@jswa9964
Copy link

jswa9964 commented Mar 7, 2025

Hey everyone, I had a bit of a puzzling issue with my on_collision event. It wasn't working and no errors were being thrown. I thought it might be something to do with my operating system (I’m on a Mac), but other window machines had the same problem.

What worked for me was using an older version of python.

I thought I’d add a link to my Issue since this thread was the first one I read to try and fix my issue.
Cheers

#45 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants