Not stable connection Python SDK
Hi everyone!
I‘m having trouble, connecting to MetaMotionC from Ubuntu using Python SDK. I have a normal Ubuntu 17.04 (not virtual) with one standard Bluetooth device onboard (named „hci0“, there are no other Bluetooth devices).
I have a problem, when I try to connect and get the data multiple times without restart of MetaMotionC device.
I have such an error:
('Exception:', RuntimeError('Channel or attrib not ready',))
Traceback (most recent call last):
File "_ctypes/callbacks.c", line 315, in 'calling callback function'
File "/usr/local/lib/python2.7/dist-packages/mbientlab/metawear/__init__.py", line 214, in _write_gatt_char
handle = self.characteristics[_gattchar_to_string(ptr_gattchar.contents)]
AttributeError: 'MetaWear' object has no attribute 'characteristics'
terminate called after throwing an instance of 'std::out_of_range'
what(): _Map_base::at
Aborted
I have this problem even with examples from Python SDK. Sometimes by the second attempt of connection, sometimes by the fifth or more - performance is just not stable.
Do you have any idea?
Thanks!
I‘m having trouble, connecting to MetaMotionC from Ubuntu using Python SDK. I have a normal Ubuntu 17.04 (not virtual) with one standard Bluetooth device onboard (named „hci0“, there are no other Bluetooth devices).
I have a problem, when I try to connect and get the data multiple times without restart of MetaMotionC device.
I have such an error:
('Exception:', RuntimeError('Channel or attrib not ready',))
Traceback (most recent call last):
File "_ctypes/callbacks.c", line 315, in 'calling callback function'
File "/usr/local/lib/python2.7/dist-packages/mbientlab/metawear/__init__.py", line 214, in _write_gatt_char
handle = self.characteristics[_gattchar_to_string(ptr_gattchar.contents)]
AttributeError: 'MetaWear' object has no attribute 'characteristics'
terminate called after throwing an instance of 'std::out_of_range'
what(): _Map_base::at
Aborted
I have this problem even with examples from Python SDK. Sometimes by the second attempt of connection, sometimes by the fifth or more - performance is just not stable.
Do you have any idea?
Thanks!
This discussion has been closed.
Comments
What version of python and bluez are you running?
Can you try using some Bluetooth USB adapters?
Who is the manufacturer of the integrated radio?
Does the JavaScript SDK perform any better?
I've tried to update the things according to the previous Laura comment.
Currently I have:
Ubuntu 17.10
Python 2.7.14
bluez 5.46
Bluetooth adapter from Intel:
$ hciconfig -a hci0
hci0: Type: Primary Bus: USB
BD Address: F8:34:41:D5:C3:F6 ACL MTU: 1021:4 SCO MTU: 96:6
UP RUNNING
RX bytes:787 acl:0 sco:0 events:58 errors:0
TX bytes:3455 acl:0 sco:0 commands:58 errors:0
Features: 0xff 0xfe 0x0f 0xfe 0xdb 0xff 0x7b 0x87
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Link policy: RSWITCH HOLD SNIFF
Link mode: SLAVE ACCEPT
Name: 'LIN-NB-001'
Class: 0x0c010c
Service Classes: Rendering, Capturing
Device Class: Computer, Laptop
HCI Version: 4.2 (0x8) Revision: 0x100
LMP Version: 4.2 (0x8) Subversion: 0x100
Manufacturer: Intel Corp. (2)
Yes, I've got extra USB BLE dongle (BlueGiga BLED112), but I'm not sure how to use it with MetaWear library: I can't see it as another bluetooth device, only on serial port.
I fear, I have to use Python in this project.. So, I didn't tried JavaScript SDK.
But by $ npm install metawear I get:
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack at ChildProcess.emit (events.js:160:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:12)
gyp ERR! System Linux 4.13.0-31-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/apolkovnikov/js_mmc/node_modules/ffi
gyp ERR! node -v v9.4.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN enoent ENOENT: no such file or directory, open '/home/apolkovnikov/js_mmc/package.json'
npm WARN js_mmc No description
npm WARN js_mmc No repository field.
npm WARN js_mmc No README data
npm WARN js_mmc No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: xpc-connection@0.1.4 (node_modules/xpc-connection):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for xpc-connection@0.1.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ffi@2.2.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ffi@2.2.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/apolkovnikov/.npm/_logs/2018-01-29T09_28_04_570Z-debug.log
node v9.4.0
noble@1.8.1
+ I've installed the prerequisites for Noble (bluetooth bluez libbluetooth-dev libudev-dev)
Last I checked, ffi had compatibility issues with node V9. Try using node V8.