Closed carlitoselmago closed 1 year ago
It would be helpful if you could please supply your test code, as well as giving us some details about your environment (I see you're in Python 3.9; what's your version of Ubuntu (and version of BlueZ if it's different than the core)?) so that we can try to reproduce. The major difference between this downloadable SDK and the Python Web Playground is the backend -- for the former, we are using Bleak, and for the latter, web-bluetooth -- so there may be some cases we've missed, and would like to solve. Thanks for your interest!
I wrote a minimal example that can reproduce this bug with BlueZ 5.53 on x86_64, but it does not happen in Windows 10. (I don't have a Mac handy to test). I have some ideas about how to fix it, though. Below is my minimal example:
from irobot_edu_sdk.robots import event, hand_over, Color, Robot, Root
import random
backend = Bluetooth()
robot = Root(backend)
@event(robot.when_play)
async def play1(robot):
while True:
print('light')
await robot.set_lights_rgb(random.randint(0,255), random.randint(0,255), random.randint(0,255))
@event(robot.when_play)
async def play2(robot):
while True:
print('beep')
await robot.play_note(440, .25)
robot.play()
Thanks for your quick response.
I have a while True: running so I quick-fixed it by adding a sleep(0.1) at the end of it and some try: except:
It's running on Ubuntu 20 server on a raspberry pi 4 (arm64) BlueZ 5.53-0ubuntu3.6
If you're comfortable, give this branch a try; if not, we'll do some more testing over the next few days before cutting a patch release.
If you pip install --upgrade
the SDK, you should get 0.1.2 which fixes this bug
I get this error when running multple functions for the event "when_play":
It does not occur when my code is runned thru the python web playground