MetaMotion Position and Orientation Tracker

Hi,
I noticed a video in the blog (https://www.kickstarter.com/projects/metawear/metamotion-10-axis-imu-dev-board-w-wireless-sensor/description) which shows an app connected to the metaemotion sensor that is used to rotate a cube. Is this an app from Mbient labs ?

Comments

  • I think it's the C# sensor fusion example.

  • Do you have something for python?

  • I have very minimum experience with programming. So can you give me an example for how to write a call back function for this in Python?

    mbl_mw_datasignal_subscribe(motion_signal, nullptr, [](void* context, const MblMwData* data) {
    auto casted = (MblMwBoschAnyMotion*) data->value;
    cout << "{sign: " << casted->sign ? "positive" : "negative" <<
    ", x-active: " << casted->x_axis_active <<
    ", y-active: " << casted->y_axis_active <<
    ", z-active: " << casted->z_axis_active <<
    "}" << endl;
    });

  • Please take a look at our tutorials and also online Python tutorials

  • AKRAKR
    edited February 2020

    Sure,I looked at the documents and tutorial and tried it myself.
    And I have an error, argument 3: : expected CFunctionType instance instead of function. I worked on getting a solution online but I am not able to solve this. Can you tell me where I am going wrong, if possible?

    libmetawear.mbl_mw_acc_bosch_set_any_motion_count(device.board, 4)
    libmetawear.mbl_mw_acc_bosch_set_any_motion_threshold(device.board, 0.75)
    libmetawear.mbl_mw_acc_bosch_write_motion_config(device.board)

        def motion_callback(self, ctx, data):
            casted = parse_value(data)
            print("sign:%d " %(casted[0].sign)," x-active:%s" %(casted[1].x_axis_active),"y-active:%s" %(casted[2].y_axis_active),"z-active:%s"%(casted[3].z_axis_active))
    
    
    
        motion_signal = libmetawear.mbl_mw_acc_bosch_get_motion_data_signal(device.board);  <----------ERROR: (argument 3: <type '                                    exceptions.TypeError'>: expected CFunctionType instance instead of function)
    
        libmetawear.mbl_mw_datasignal_subscribe(motion_signal, None, motion_callback)
        libmetawear.mbl_mw_acc_bosch_enable_motion_detection(device.board)
    
        libmetawear.mbl_mw_acc_bosch_start(device.board);
        sleep(10.0)
        libmetawear.mbl_mw_debug_disconnect(device.board)
        print("Press 0 to disconnect")
    
  • Did you include all the required libraries/packages?

  • from mbientlab.metawear import MetaWear, libmetawear, parse_value
    from mbientlab.metawear.cbindings import *
    from mbientlab.warble import *
    from mbientlab.metawear import *

  • AKRAKR
    edited February 2020

    def motion_callback(self, ctx, data):
    casted = parse_value(data)
    print("{sign: %d , x-active: %s, y-active: %s, z-active: %s}" %(casted.sign,casted.x_axis_active,casted.y_axis_active, casted.z_axis_active))

        fn_wrapper = FnVoid_VoidP_DataP(motion_callback)
        #print("Motion Config")
        libmetawear.mbl_mw_gyro_bmi160_start(device.board)
        libmetawear.mbl_mw_acc_bosch_set_any_motion_count(device.board, 2)
        libmetawear.mbl_mw_acc_bosch_set_any_motion_threshold(device.board, 0.5)
        libmetawear.mbl_mw_acc_bosch_write_motion_config(device.board)
    
        # Enable Motion Detection
        libmetawear.mbl_mw_acc_bosch_enable_motion_detection(device.board)
        libmetawear.mbl_mw_acc_bosch_start(device.board);
    
        #Subscribe to motion data
        motion_signal = libmetawear.mbl_mw_acc_bosch_get_motion_data_signal(device.board);
        libmetawear.mbl_mw_datasignal_subscribe(motion_signal, None, fn_wrapper)
    
        sleep(10.0)
    
        libmetawear.mbl_mw_acc_bosch_disable_motion_detection(device.board)
        libmetawear.mbl_mw_datasignal_unsubscribe(motion_signal, None, fn_wrapper)
        libmetawear.mbl_mw_debug_disconnect(device.board)
        print("Press 0 to disconnect")
    

    This works without any error, but does not print anything or shows the direction of motion.

  • Hi, I kind off fixed the issue for now.

  • @AKR, awesome news, that did you do?

  • AKRAKR
    edited February 2020

    Yes I did by myself. I managed to fix the issue and now I can print the result. So, it gives me the direction and sign along the axis of acceleration.
    Thanks for your support.

    Is it possible to estimate the stride length using two MMR sensor placed on both thighs?

  • Hi @AKR, Yes it is possible but you also need to know basic information such as the height of the person.

  • Great. Thanks.
    Is there any information that you can share it with me regarding this ?
    Like a pseudocode or something? It would be of great help. Thanks

  • edited February 2020

    I would google white papers on this topic.
    We are sensors expert. What you do with the data is entirely up to you, we don't do any of the data analysis (thats your job - :) )

  • @Laura said:
    I would google white papers on this topic.
    We are sensors expert. What you do with the data is entirely up to you, we don't do any of the data analysis (thats your job - :) )

    Thanks fair enough.

  • AKRAKR
    edited February 2020

    Thanks

Sign In or Register to comment.