Unable to connect to MetaMotionR devices using Raspberry Pi
My task is to connect 8 MetaMotionR devices to the MetaHub and collect sensor data simultaneously using Metawear Python SDK along with the pygattlib library. I'm using a Bluetooth dongle to connect to the devices.The program that I am developing has two data collection modes:
- collect raw data from all devices (accelerometer, gyro-meter, and magnetometer)
- collect Euler angles from all devices (sensor fusion)
The task seems simple but the unpredictable behavior of the MetaMotionR devices and the Bluetooth dongle has made it almost impossible for me to connect all 8 devices (not even 4 devices) and collect readings at the same time. My program has 4 stages:
- Discover nearby devices
- connect to selected devices
- collect data from sensors
- Disconnect devices
Most of the errors occur at the second stage of the program, specifically when trying to connect to a device using the method device.connect(), where device is an instance of the class MetaWear. When running the program there is always a big probability that an error will occur while connecting to one of the devices. The errors that I discovered are:
- Segmentation Fault
- *** Error in ‘python’: double free or corruption (fasttop): 0x75c0ad10 *** Aborted
- RuntimeError: device not responding
- RuntimeError: Error initializing API
Error 3 has a trace back to file _ctypes/callbacks.c (line 315 in ‘calling callback function’) and to file mbientlab/metawear/__init__.py (line 198 in _read_gatt_char).
At stage 3 of the program, a ‘RuntimeError: channel attribute not ready’ error occurred while collecting data.