hybridgroup / cylon

JavaScript framework for robotics, drones, and the Internet of Things (IoT)
https://cylonjs.com
Other
4.2k stars 360 forks source link

BB-8 losing servies and characteristics #364

Open Oradim opened 7 years ago

Oradim commented 7 years ago

Hi I just started to connect my BB-8 to a Raspberry pi 3. I used cylon, cylon-ble and cylon-sphero-ble. Yesterday I was able to execute the standard script for a few times (5-10 times). But when I tried to use the exact same script today I am not able to connect to the BB-8. I get the following error:

pi@raspberrypi:~/node_modules/noble/examples $ sudo node Cylontest.js 2017-03-22T08:56:35.341Z : [Robot 1] - Starting connections. 2017-03-22T08:56:35.364Z : [Robot 1] - Starting connection 'bluetooth'. 2017-03-22T08:56:48.661Z : [Robot 1] - Starting devices. 2017-03-22T08:56:48.663Z : [Robot 1] - Starting device 'bb8'. noble warning: unknown handle 64 disconnected! /home/pi/node_modules/cylon-sphero-ble/node_modules/sphero/lib/adaptors/ble.js:404 return this._connectedService(serviceId).characteristics; ^

TypeError: Cannot read property 'characteristics' of null at Adaptor._connectedCharacteristics (/home/pi/node_modules/cylon-sphero-ble/node_modules/sphero/lib/adaptors/ble.js:404:43) at Adaptor._connectCharacteristic (/home/pi/node_modules/cylon-sphero-ble/node_modules/sphero/lib/adaptors/ble.js:357:12) at /home/pi/node_modules/cylon-sphero-ble/node_modules/sphero/lib/adaptors/ble.js:302:12 at Adaptor._connectService (/home/pi/node_modules/cylon-sphero-ble/node_modules/sphero/lib/adaptors/ble.js:338:5) at /home/pi/node_modules/cylon-sphero-ble/node_modules/sphero/lib/adaptors/ble.js:300:10 at Adaptor._connectBLE (/home/pi/node_modules/cylon-sphero-ble/node_modules/sphero/lib/adaptors/ble.js:324:5) at Adaptor.getCharacteristic (/home/pi/node_modules/cylon-sphero-ble/node_modules/sphero/lib/adaptors/ble.js:299:8) at Adaptor.writeServiceCharacteristic (/home/pi/node_modules/cylon-sphero-ble/node_modules/sphero/lib/adaptors/ble.js:274:8) at Adaptor.setTXPower (/home/pi/node_modules/cylon-sphero-ble/node_modules/sphero/lib/adaptors/ble.js:203:8) at /home/pi/node_modules/cylon-sphero-ble/node_modules/sphero/lib/adaptors/ble.js:156:10

I then tried the peropheral-explorer.js and got the following output:

pi@raspberrypi:~/node_modules/noble/examples $ sudo node peripheral-explorer.js d846e13d148d peripheral with ID d846e13d148d found Local Name = BB-148D TX Power Level = -10 Manufacturer Data = 3330 Service Data = Service UUIDs = 22bb746f2ba075542d6f726568705327

services and characteristics:

There are no services and characteristics listed. I also tried to force a firmwareupdate on the BB-8 what worked perfectly. I also updated noble, sphero, cylon, cylon-ble, cylon-sphero-ble. but I cannot find the error. Sometimes I also get the following noble warning:

noble warning: unknown handle 64 disconnected!

Does anyone have an idea what the problem is and how I could fix it?

I also tried to use the standard sperho.js sdk but I get the same error.

I also noticed when I force a firmwareupdate on the BB-8 and than run the peripheral-explorer.js script I get the following output: pi@raspberrypi:~/node_modules/noble/examples $ sudo node peripheral-explorer.js D8:46:E1:3D:14:8D peripheral with ID d846e13d148d found Local Name = BB-148D TX Power Level = -10 Manufacturer Data = 3330 Service Data = Service UUIDs = 22bb746f2ba075542d6f726568705327

services and characteristics: 1800 (Generic Access) 1801 (Generic Attribute) 2a00 (Device Name) properties read value | '' 2a01 (Appearance) properties read value | '' 2a04 (Peripheral Preferred Connection Parameters) properties read value | '' When I then call then call the script I get the error that the characteristics are null. After that the peripheral-explorer.js script won't find any services or characteristics until I force a new firmware update on the BB-8.

I hope someone could help me.