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

Writing lag on OSX #35

Closed
mindoftea opened this issue Jun 21, 2014 · 5 comments
Closed

Writing lag on OSX #35

mindoftea opened this issue Jun 21, 2014 · 5 comments

Comments

@mindoftea
Copy link

Hey there.

I've been using your software recently to relay commands from a ps3 controller to an Arduino-based robot. It works really well, except that it takes 250ms to write data to the Arduino's bluetooth. For a robot which needs quick moment-to-moment controls, this is quite unwieldy.

When the write command is called for the first time, it can take as few as 10ms to summon its callback. Within two or three calls, however, it slows to exactly 250ms. I've checked that the ps3-parser I wrote is serving data fast enough and that the Arduino is reading data fast enough; both systems perform in the <20ms range. I've put together a minimal test case which you can see here: https://gist.github.com/mindoftea/ac6ca90687e0f1c10d0f.

Do you know why this might be happening? I wondered if it might be an OSX-specific issue, but I don't have another machine to test it on.

Thanks!

@eelcocramer
Copy link
Owner

Hi, thank you for the feedback and test case. I've few busy weeks coming up and I probably do not have time to try it out the coming 3 weeks or so. I will test your case on both Linux and OSX.

@mindoftea
Copy link
Author

Thanks! Let me know.

@eelcocramer
Copy link
Owner

It has been a while since you posted this but I can verify the 250ms lag on OSX. I've tested your script on Linux as well and I do no see any lag there (mostly 0 or sometimes 1ms lag).

Currently I have no clue were this lags comes from.

@eelcocramer
Copy link
Owner

Removing the singleton in a possible fix for issue #51 makes the locking mechanism for devices no longer necessary. Removing these locks improves the writing speeds until similar performance as seen on Linux.

@mindoftea
Copy link
Author

Yes, locking sounds like the culprit. I can't test it right now (no bluetooth device), but will be able to in a few days. Thanks.

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

No branches or pull requests

2 participants