Problem while streaming data with 2 MetaMotionR devices

Hello,

I own two MetaMotionR devices(Hardware 0.3, Firmware 1.4.5, Model Number 5) and i am trying to run the stream_data.py 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/blestatemachine.cc): 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 stream_data.py 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.

Comments

  • 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?

    Best,

    Vassilis

  • @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?

    Best,

    Vassilis

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

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

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

  • edited October 2019

    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 stream_acc.py [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')
    d.connect()
    print("Connected to " + d.address)
    states.append(State(d))

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

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

    sleep(30.0)

    for s in states:
    libmetawear.mbl_mw_acc_stop(s.device.board)
    libmetawear.mbl_mw_acc_disable_acceleration_sampling(s.device.board)

    signal = libmetawear.mbl_mw_acc_get_acceleration_data_signal(s.device.board)
    libmetawear.mbl_mw_datasignal_unsubscribe(signal)
    libmetawear.mbl_mw_debug_disconnect(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 2019

    5 Minutes Test:

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

  • I have the same issue.

  • which hardware do you use? I was testing with a T460 Thinkpad

  • So this doesn't happen with a single device? What's your setup?

Sign In or Register to comment.