Problem while streaming data with 2 MetaMotionR devices


I own two MetaMotionR devices(Hardware 0.3, Firmware 1.4.5, Model Number 5) and i am trying to run the script with both devices simultaneously. I run it on ubuntu linux 16.04 lts with python 3.5. Firstly before a connection is established with each sensor, an error message is printed in the screen stating the following:" error 1570631669.229802: Error on line: 296 (src/ Operation now in progress". The program continues its execution and the sensors begin to stream the data at 25 hz as it is configured in the script. After 30 seconds when the program stops, there is a large difference in the data that each sensor streamed. The first sensor that connects is always streaming at a lower frequency than the second. So the total samples for example are something like 440 samples for the first device and 754 samples for the second. When i configure the frequency to be 100hz the difference is even bigger, having a total of 400 samples for the first device and approximately 3000 samples for the second.

Please advice on how to troubleshoot this,

Thank you.


  • Looks like everything is working fine.

    First, we have another post on the forum about ignoring the blestatemachine error, go read it.

    Second, if each sensor works just fine individually with the script, the sensors are completely fine. The script is supposed to stream for 30 seconds. Read the code.

    I don't see any issues here. Will close thread.

  • Dear Laura,

    Thank you for your prompt reply.
    While each sensor streams at the correct frequency, when used alone, when I try to connect simultaneously the two Imus, one of them drops each data rate below 30%.
    I have read the code line by line.

    What should I check?



  • @vtsakan said:
    Dear Laura,

    Thank you for your prompt reply.
    While each sensor streams at the correct frequency, when used alone, when I try to connect simultaneously the two Imus, one of them drops each data rate below 30%.
    I have read the code line by line.

    What should I check?



    I also forgot to mention that I am using the instructions from your documentation. I made the changes in the file, as suggested.

  • is not supported anymore.
    You can post your code but really it will be up to you to fix your code.

  • So, can I connect two Imus at the same time and get the data streams without reduced frequency?

  • edited October 9

    Yes but you need to set it up properly.

  • Besides multi_dev, is there another example that I can base on? I can also use two different adapters ( one for each Imus). Will this be more robust?

    I will post the code tomorrow. I would be grateful if you can offer some advice or direction.

  • Here is the code that i run. Could you give me some guidance on what should i do ? I also tried to connect to each imu with a different bluetooth adapter but to no avail. Thanks in advance.

    usage: python [mac1] [mac2] ... [mac(n)]

    from future import print_function
    from mbientlab.metawear import MetaWear, libmetawear, parse_value
    from mbientlab.metawear.cbindings import *
    from time import sleep
    from threading import Event

    import platform
    import sys

    if sys.version_info[0] == 2:
    range = xrange

    class State:
    def init(self, device):
    self.device = device
    self.samples = 0
    self.callback = FnVoid_VoidP_DataP(self.data_handler)

    def data_handler(self, ctx, data):
        print("%s -> %s" % (self.device.address, parse_value(data)))
        self.samples+= 1

    states = []
    for i in range(len(sys.argv) - 1):
    d = MetaWear(sys.argv[i + 1],d='hci0')
    print("Connected to " + d.address)

    for s in states:
    print("Configuring device")
    libmetawear.mbl_mw_settings_set_connection_parameters(s.device.board, 7.5, 7.5, 0, 6000)

    libmetawear.mbl_mw_acc_set_odr(s.device.board, 25.0)
    libmetawear.mbl_mw_acc_set_range(s.device.board, 16.0)
    signal = libmetawear.mbl_mw_acc_get_acceleration_data_signal(s.device.board)
    libmetawear.mbl_mw_datasignal_subscribe(signal, None, s.callback)


    for s in states:

    signal = libmetawear.mbl_mw_acc_get_acceleration_data_signal(s.device.board)

    print("Total Samples Received")
    for s in states:
    print("%s -> %d" % (s.device.address, s.samples))

  • This code looks fine. Please update your comment to format it properly.
    What do you expect to happen? What happens instead?

  • I tried your code and got this result:

    Total Samples Received
    C3:25:9F:99:7D:B9 -> 567, 18.9
    F8:A3:30:FB:EA:57 -> 732, 24.4

    The second MMR came close to the configured 25 measurements/Second, the other one only got to 18.9/second.

  • Run it longer

  • edited October 10

    5 Minutes Test:

    Total Samples Received
    C3:25:9F:99:7D:B9 -> 5530, 18.4
    F8:A3:30:FB:EA:57 -> 7398, 24.7

  • Try one at a time. Debug something mate.

  • "Debug something mate." :)

    That's really not that simple without a good documentation. Is the C++-API really the only 'documentation' for the python-interface? Or am I completely missing the python-docu?

  • edited October 11

    Debug something. Try stuff. Experiment. Document...

  • Are you serious? Your product does behave strangely and that is your response? What documentation do you need? Do you have any proposals for other experiments?

Sign In or Register to comment.