Digital input data signal logging failed with out_of_range error in MMS

I am using MMS and trying to log the digital input signal with reference to examples/
I have successfully logged by replacing the mbl_mw_multi_chnl_temp_get_temperature_data_signal function in examples/ with the mbl_mw_gpio_get_digital_input_data_signal function. But when I divided the scripts to start logging and anonymous download for long-term logging, out_of_range error occurs with the following message at mbl_mw_metawearboard_create_anonymous_datasignals.

terminate called after throwing an instance of 'std::out_of_range'
  what():  _Map_base::at
Aborted (core dumped)

This error doesn’t happen for temperature logging so I guess mbl_mw_metawearboard_create_anonymous_datasignals doesn’t support digital input signal logging or C++ library bug. If you know anything about it, please reply.

  • Environment

    • Ubuntu 20.04
    • Bluez 5.50
    • MetaWear SDK for Python by MBIENTLAB
  • Start logging script based on examples/

# usage: python3 [mac]
from __future__ import print_function
from mbientlab.metawear import MetaWear, libmetawear, parse_value, create_voidp, create_voidp_int
from mbientlab.metawear.cbindings import *
from time import sleep
from threading import Event

import sys

# connect
print("Searching for device...")
d = MetaWear(sys.argv[1])
print("Connected to " + d.address + " over " + ("USB" if d.usb.is_connected else "BLE"))

    # setup events
    e = Event()
    print("Configuring device")

    # get temp signal and setup logger
    print("Get and log digital input")
    di_signal = libmetawear.mbl_mw_gpio_get_digital_input_data_signal(d.board, 2)
    di_logger = create_voidp(lambda fn: libmetawear.mbl_mw_datasignal_log(di_signal, None, fn), resource = "di_logger", event=e)

    # create a timer
    timer = create_voidp(lambda fn: libmetawear.mbl_mw_timer_create_indefinite(d.board, 1000, 0, None, fn), resource = "timer", event = e)

    # record an event

    # event is to read temp signal
    create_voidp_int(lambda fn: libmetawear.mbl_mw_event_end_record(timer, None, fn), event = e)

    # start logging
    libmetawear.mbl_mw_logging_start(d.board, 0)

    # start timer

except RuntimeError as err:
    e = Event()
    d.on_disconnect = lambda status: e.set()
  • Anonymous download script → examples/


Sign In or Register to comment.