Open mischamol opened 4 years ago
I have the same issue. The program is pretty much the same:
` import logging
from curio import sleep from bricknil import attach, start from bricknil.hub import BoostHub from bricknil.sensor import InternalMotor
@attach(InternalMotor, name='motor_left', port=InternalMotor.Port.A) class Robot(BoostHub): async def run(self): self.message_info("Running") while (True): self.message_info('start') await self.motor_left.set_speed(10) self.message_info('Speed set') await sleep(3)
async def system(): robot = Robot('Test')
if name == 'main': logging.basicConfig(level=logging.INFO) start(system) `
Versions involved: bleak 0.6.4 bricknil 0.9.3 curio 1.2
While the trace log is:
` inside curio run loop INFO:BLE Event Q.0:Clearing BLE cache data INFO:BLE Event Q.0:Found adapter Default Adapter INFO:BLE Event Q.0:Powering up adapter Default Adapter INFO:BLE Event Q.0:Starting scan for UART 00001623-1212-efde-1623-785feabcd123 INFO:BLE Event Q.0:Looking for first matching hub INFO:BLE Event Q.0:Rescanning for 00001623-1212-efde-1623-785feabcd123 (60 tries left) INFO:BLE Event Q.0:Rescanning for 00001623-1212-efde-1623-785feabcd123 (59 tries left) INFO:BLE Event Q.0:Rescanning for 00001623-1212-efde-1623-785feabcd123 (58 tries left) INFO:BLE Event Q.0:Rescanning for 00001623-1212-efde-1623-785feabcd123 (57 tries left) INFO:BLE Event Q.0:Rescanning for 00001623-1212-efde-1623-785feabcd123 (56 tries left) INFO:BLE Event Q.0:Rescanning for 00001623-1212-efde-1623-785feabcd123 (55 tries left) INFO:BLE Event Q.0:Rescanning for 00001623-1212-efde-1623-785feabcd123 (54 tries left) INFO:BLE Event Q.0:advertised: [UUID('00001623-1212-efde-1623-785feabcd123'), 151, 3, 0, 64, 6, 0, 67, 0] INFO:BLE Event Q.0:checking manufacturer ID for device named LEGO Move Hub for LEGO Move Hub INFO:BLE Event Q.0:found device LEGO Move Hub INFO:BLE Event Q.0:Device advertised [UUID('00001623-1212-efde-1623-785feabcd123'), 151, 3, 0, 64, 6, 0, 67, 0] INFO:BLE Event Q.0:Connected to device LEGO Move Hub:a539a85f-cf7c-4930-b847-3653e88e0cd9 INFO:BLE Event Q.0:Waiting for hubs to end INFO:Test.3:Running INFO:Test.3:start INFO:motor_left.2:Setting speed to 10
2020-06-30 11:03:05.095 Python[10458:1191390] *** Terminating app due to uncaught exception 'OC_PythonException', reason: '<class 'AssertionError'>: Unknown device with id 66 being attached (port 70'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff3cf59acd __exceptionPreprocess + 256
1 libobjc.A.dylib 0x00007fff6765da17 objc_exception_throw + 48
2 CoreFoundation 0x00007fff3cf73629 -[NSException raise] + 9
3 _objc.cpython-38-darwin.so 0x0000000104f728fe PyObjCErr_ToObjCWithGILState + 46
4 _objc.cpython-38-darwin.so 0x0000000104f6ac64 -[OC_PythonObject forwardInvocation:] + 708
5 CoreFoundation 0x00007fff3cefb67e ___forwarding___ + 780
6 CoreFoundation 0x00007fff3cefb2e8 _CF_forwarding_prep_0 + 120
7 CoreBluetooth 0x00007fff3c9d7ed4 -[CBPeripheral handleAttributeEvent:args:attributeSelector:delegateSelector:delegateFlag:] + 239
8 CoreBluetooth 0x00007fff3c9d800e -[CBPeripheral handleCharacteristicEvent:characteristicSelector:delegateSelector:delegateFlag:] + 115
9 CoreBluetooth 0x00007fff3c9d3a7e -[CBPeripheral handleMsg:args:] + 297
10 CoreBluetooth 0x00007fff3c9ce368 -[CBCentralManager handleMsg:args:] + 198
11 CoreBluetooth 0x00007fff3c9c97db __30-[CBXpcConnection _handleMsg:]_block_invoke + 53
12 libdispatch.dylib 0x00007fff68dde5f8 _dispatch_call_block_and_release + 12
13 libdispatch.dylib 0x00007fff68ddf63d _dispatch_client_callout + 8
14 libdispatch.dylib 0x00007fff68de58e0 _dispatch_lane_serial_drain + 602
15 libdispatch.dylib 0x00007fff68de63c6 _dispatch_lane_invoke + 433
16 libdispatch.dylib 0x00007fff68de5792 _dispatch_lane_serial_drain + 268
17 libdispatch.dylib 0x00007fff68de6396 _dispatch_lane_invoke + 385
18 libdispatch.dylib 0x00007fff68dee6ed _dispatch_workloop_worker_thread + 598
19 libsystem_pthread.dylib 0x00007fff6901f611 _pthread_wqthread + 421
20 libsystem_pthread.dylib 0x00007fff6901f3fd start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Abort trap: 6
`
@mischamol @LasseD It seems like the latest Lego BOOST firmware added a new port. Take a look at https://github.com/virantha/bricknil/pull/29.
I have the same issue and can verify #29 fixed it for me. Thanks @josuemontano !
Thanks for the great piece of work! I have one issue I don't seem able to solve. Every time when I run a simple piece of code on my Mac communicating with one of my boost sensors it crashes, stating something about an unknown device being attached. This happens with all sensors. Any suggestions what is going wrong?
...... INFO:BLE Event Q.0:Connected to device LEGO Move Hub:c631f6ec-........ INFO:BLE Event Q.0:Waiting for hubs to end INFO:Test.3:Running INFO:Test.3:start INFO:motor_left.2:Setting speed to 10 2020-06-17 21:11:49.597 python[1206:29044] *** Terminating app due to uncaught exception 'OC_PythonException', reason: '<class 'AssertionError'>: Unknown device with id 66 being attached (port 70' .......
And the code I'm running.
`import logging
from curio import sleep from bricknil import attach, start from bricknil.hub import BoostHub from bricknil.sensor import InternalMotor
@attach(InternalMotor, name='motor_right', port=InternalMotor.Port.B) @attach(InternalMotor, name='motor_left', port=InternalMotor.Port.A)
class Robot(BoostHub):
async def system(): robot = Robot('Test')
if name == 'main': logging.basicConfig(level=logging.INFO) start(system)`