in python example of GYRO data segmentation fault

i would like to ask a problem that occurs when i run the python code with uses the C++ APIs library

there is a setting called enable high frequency stream when i enable it and then run the python code i can discover the board and connect to it then when i start to get the data i get segmentation fault instead

so what does this enable high frequency stream do and why does the libmetawear give this error and how can i fix it

i am using CentOS with MeaWear CPro and pygatt back end.

Comments

  • Can you post the full python code you are using along with the firmware revision that your board is currently running?
  • currently i am using MetaWear CPro boards with firmware 1.2.2
    i use it with pygatt back end and the python code i am using is the ACC example code provided with the pymetawear python warper for the C++ APIs with few modifications for storing the data in csv

    here is the code it self and the problem is when i set high frequency stream to true and run the code after it connects to the board it gives segmentation fault

    #!/usr/bin/env python
    # -*- coding: utf-8 -*-
    """
    :mod:`accelerometer`
    ==================

    Created by hbldh <henrik.blidh@nedomkull.com>
    Created on 2016-04-10

    """

    from __future__ import division
    from __future__ import print_function
    from __future__ import absolute_import

    import time, datetime, csv, pygatt, signal
    from datetime import datetime

    from pymetawear.discover import select_device
    from pymetawear.client import MetaWearClient

    address = select_device()
    c = MetaWearClient(str(address), 'pygatt', debug=True)
    print("New client created: {0}".format(c))

    def handler(signum, frame):
    print ("force disconnect")
    c.accelerometer.notifications(None)
    time.sleep(5.0)
    c.disconnect()

    signal.signal(signal.SIGTSTP, handler)

    def acc_callback(data):
    """Handle a (epoch, (x,y,z)) accelerometer tuple."""
    now = datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%S.%f')
    print("Client, X: {1}, Y: {2}, Z: {3}".format(data[0], *data[1]))

    datastr = ("{1},{2},{3}".format(data[0], *data[1]))
    data="".join(datastr)
    datarow=now+","+data

    with open('acc.csv', 'a') as csvfile:
    writer = csv.writer(csvfile, delimiter=' ',
    escapechar=' ', quoting=csv.QUOTE_NONE)
    writer.writerow([datarow])

    print("Write accelerometer settings...")
    c.accelerometer.set_settings(data_rate=50.0, data_range=16.0)
    print("Subscribing to accelerometer signal notifications...")
    c.accelerometer.high_frequency_stream = False
    c.accelerometer.notifications(acc_callback)

    while(1):
    time.sleep(10.0)

  • High frequency streaming is only available on firmware v1.2.3 and later; update your board's firmware with an Android or iOS device.

    Furthermore, pymetawear is a community provided library that layers its own API over the the python wrappers.  Questions pertaining to that library may be better answered by the author.

This discussion has been closed.