Incorrect data when using time data processor on sensor fusion signals

Hi,

I just tried using the time data processor to limit the sampling rate of the different sensor fusion channels to allow the simultaneous streaming of more than one data_signal over BLE.
This is working so far, as that I am able to get samples from multiple channels, but the data in these channels is, for lack of a better word, strange.

My setup of the processor was done using the pymetawear python library using the python wrapper of the c++ API. 
The relevant calls to the library are the following:

data_source = sensor.SensorFusion.DATA_CORRECTED_ACC
data_signal = libmetawear.mbl_mw_sensor_fusion_get_data_signal(self.board, data_source)
mode = processor.Time.MODE_ABSOLUTE
libmetawear.mbl_mw_dataprocessor_time_create(data_source, mode, 20, core.Fn_VoidPtr(processor_set))

# the processor_set callback will assign the returned processor to the processor_signal variable

libmetawear.mbl_mw_datasignal_subscribe(processor_signal, data_callback)

Comments

  • excerpt from data_callback:
    if data.contents.type_id == DataTypeId.CARTESIAN_FLOAT:
                epoch = int(data.contents.epoch)
                data_ptr = cast(data.contents.value, POINTER(CartesianFloat))
                func((epoch, (data_ptr.contents.x,
                              data_ptr.contents.y,
                              data_ptr.contents.z)))
            elif data.contents.type_id == DataTypeId.QUATERNION:
                epoch = int(data.contents.epoch)
                data_ptr = cast(data.contents.value, POINTER(Quaternion))
                func((epoch, (data_ptr.contents.w,
                              data_ptr.contents.x,
                              data_ptr.contents.y,
                              data_ptr.contents.z)))
            elif data.contents.type_id == DataTypeId.CORRECTED_CARTESIAN_FLOAT:
                epoch = int(data.contents.epoch)
                data_ptr = cast(data.contents.value,
                                POINTER(CorrectedCartesianFloat))
                func((epoch, (data_ptr.contents.x,
                              data_ptr.contents.y,
                              data_ptr.contents.z,
                              data_ptr.contents.accuracy)))
            elif data.contents.type_id == DataTypeId.EULER_ANGLES:
                epoch = int(data.contents.epoch)
                data_ptr = cast(data.contents.value, POINTER(EulerAngle))
                func((epoch, (data_ptr.contents.heading,
                              data_ptr.contents.pitch,
                              data_ptr.contents.roll,
                              data_ptr.contents.yaw)))

    Upon doing this, I will get the following samples, if I activate Gyro, Acc and Quaternions:
  • ACC [1486112398040] X: 0.150677740574, Y: 7.78850846143e+31, Z: 4.08326740475e-11, ACCU: 107
    2017-02-03 09:59:58,040 DEBUG Notify 0x001f: 09 03 01 a4 3d 79 3d 87
    GYRO [1486112398041] X: 0.0608498007059, Y: 7.78851213656e+34, Z: 7.17464813734e-43, ACCU: 0
    2017-02-03 09:59:58,041 DEBUG Notify 0x001f: 09 03 02 2c b4 4f 3e 45 82 b9 3d
    QUAT [1486112398041] W 0.202835738659, X 0.0905805006623, Y 4.08326741308e-08, Z 1.17163503472e-38
    2017-02-03 09:59:58,107 DEBUG Notify 0x001f: 09 03 00 00 f8 14 43 60
    ACC [1486112398108] X: 0.148968756199, Y: 7.78849298718e+31, Z: 1.40129846432e-45, ACCU: 0
    2017-02-03 09:59:58,108 DEBUG Notify 0x001f: 09 03 01 a4 3d 79 3d 1a
    GYRO [1486112398108] X: 0.0608498007059, Y: 7.78845816238e+34, Z: 4.08326741308e-08, ACCU: 107
    2017-02-03 09:59:58,109 DEBUG Notify 0x001f: 09 03 02 2c b4 4f 3e 45 82 b9 3d
    QUAT [1486112398109] W 0.202835738659, X 0.0905805006623, Y 7.17464813734e-43, Z 0.0
    2017-02-03 09:59:58,110 DEBUG Notify 0x001f: 09 03 00 00 69 17 43 00
    ACC [1486112398110] X: 0.151410162449, Y: 7.78844511372e+31, Z: 4.08326740475e-11, ACCU: 107
    2017-02-03 09:59:58,111 DEBUG Notify 0x001f: 09 03 01 cc f8 fb bc a3
    GYRO [1486112398111] X: -0.0307582840323, Y: 7.78852600149e+34, Z: 7.17464813734e-43, ACCU: 0
    2017-02-03 09:59:58,117 DEBUG Notify 0x001f: 09 03 02 2c b4 4f 3e 45 82 b9 3d
    QUAT [1486112398117] W 0.202835738659, X 0.0905805006623, Y 4.08326741308e-08, Z 1.17163503472e-38
  • If I do not activate the data processor (and only stream one channel at a time) I will get the following:

    2017-02-03 10:02:17,059 DEBUG Notify 0x001f: 19 04 80 36 15 43 a0 59 75 44 00 6e 6a 42 03
    ACC [1486112537059] X: 0.149212896824, Y: 0.981400370598, Z: 0.0586074218154, ACCU: 3
    2017-02-03 10:02:17,059 DEBUG Notify 0x001f: 19 04 80 a7 17 43 80 0b 75 44 00 7a 68 42 03
    ACC [1486112537059] X: 0.151654303074, Y: 0.980179667473, Z: 0.0581191405654, ACCU: 3

    2017-02-03 10:07:40,182 DEBUG Notify 0x001f: 19 07 a7 75 75 3e 46 c5 01 3e 99 e4 2c bf aa 92 2f bf
    QUAT [1486112860182] W 0.239706620574, X 0.126729100943, Y -0.675363123417, Z -0.685831665993
    2017-02-03 10:07:40,183 DEBUG Notify 0x001f: 19 07 a7 75 75 3e 46 c5 01 3e 99 e4 2c bf aa 92 2f bf
    QUAT [1486112860183] W 0.239706620574, X 0.126729100943, Y -0.675363123417, Z -0.685831665993

    2017-02-03 10:08:57,530 DEBUG Notify 0x001f: 19 05 bc 0f 7b bd 4d a2 78 3d 9a 89 3b 3e 03
    GYRO [1486112937530] X: -0.0612943023443, Y: 0.0607016570866, Z: 0.183142095804, ACCU: 3
    2017-02-03 10:08:57,530 DEBUG Notify 0x001f: 19 05 1d 08 69 b9 d1 1d f7 3c da ff f9 3d 03
    GYRO [1486112937530] X: -0.000222236340051, Y: 0.0301655847579, Z: 0.122070029378, ACCU: 3

    Note that the first channel seems to be correct for the processed signals, all following are either very large or very small and are not valid readings.

    Am I using the processor incorrectly?
  • The C++ API does not yet correctly configure the time filter for use with sensor fusion output.  We are working on a small update to address this and a few other bugs.
Sign In or Register to comment.