Accelerometer G magnitude calculation and Avg data processor

Hello,

I am using MetaWear CPRO device with 1.2.5 firmware on Windows 10.

I trying to build an application to detect punches and their length, impact G, max forward G, etc.

My proposed solution is to calculate length of accelorometer vector and filter values greater than determined value. In the application I will do further calculations to match the values to a punch profile.

My data processor setup is below:

            //odr:50f range: 16g

            punchDetectorDelegates = new Dictionary<string, Fn_IntPtr>
            {
                //logger and log ready delegates..
                //..

                ["comp"] = new Fn_IntPtr(avg =>
                {
                    mbl_mw_dataprocessor_comparator_create( avg, Comparator.Operation.GTE, 4f,  punchDetectorDelegates["punch"]);
                }),
                ["avg"] = new Fn_IntPtr(rss =>
                {
                    mbl_mw_dataprocessor_average_create(rss, 4, punchDetectorDelegates["comp"]);
                })
            };
            
            //mbl_mw_dataprocessor_rss_create(acc_signal, punchDetectorDelegates["comp"]);
            mbl_mw_dataprocessor_rss_create(acc_signal, punchDetectorDelegates["avg"]);

My questions:
1. Is my approach is suitable for punch detection? (I am ignoring gravity)
2. When range is set to 16, I am expecting maximum length of sqrt(16*16*3) ~  27.71. Is this right?
3. When I send rss output to "comp" delegate, I get values that suits the above value. But when I send  rss output to "avg" delegate, I get values above 27.71 like 31. what am I missing here? How avg proccessor find result that seems out of range?

Comments

    1. Sounds good enough to at least detect potential matches
    2. Yes, that is correct.
    3. Hrm that's odd.  Can you record the rss and avg values and post them in the thread?
    Also, when/where are you configuring the accelerometer in your code?
  • I have got Windows update and even FreeFall detector sample is not working. It is throwing System.Runtime.InteropServices.SEHException at: 
    mbl_mw_acc_set_odr(board, 50f);

    Windows Version is: 1703 (15063.332)

    The device is working fine with Adroid App. I have tried removing battery, updating firmware, re-installing bluetooth drivers, re-pairing device and x86/x64 configurations. Nothing works.

    Any idea?
  • Increasing response timeout fixed my problem. But I don't know its relation to Windows update yet. It breaks Windows Forms solution, I have added Registry value to fixed it.

    I add following line just before initialization:

    mbl_mw_metawearboard_set_time_for_response(board, 4000);
This discussion has been closed.