Skip to content
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

Potential bugs in collision detection #41

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

Potential bugs in collision detection #41

SJ-Fang23 opened this issue Oct 29, 2023 · 2 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.

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

2 participants