Quaternion Sensor Streaming Issues

Hello!

For my project I am working with the sensor fusion only using Quaternions and I am having issues with code skipping over "mbl_mw_datasignal_subscribe(signal, bridge(obj: device.self)) { (context, obj) in
}"
which resolves in no live streaming, I used the template that you guys offered in your Swift APIs under Sensor Fusion and was wondering if I'm missing anything or things need to be changed in order to stream.

my code:
func StartStream() {
if deviceArray.count > 0 {
for device in deviceArray {
print("Device true")
let signal = mbl_mw_sensor_fusion_get_data_signal(device.board, MBL_MW_SENSOR_FUSION_DATA_QUATERNION)!
print("signal is passed")

            mbl_mw_datasignal_subscribe(signal, bridge(obj: device.self)) { (context, obj) in
                let quaternion: MblMwQuaternion = obj!.pointee.valueAs()
                print(Double(quaternion.x))
                    print(Double(quaternion.y))
                    print(Double(quaternion.z))
                    print(Double(quaternion.w))
                print("Device subscribed")

            }
                print("fusion")
        mbl_mw_sensor_fusion_clear_enabled_mask(device.board)
        mbl_mw_sensor_fusion_enable_data(device.board, MBL_MW_SENSOR_FUSION_DATA_QUATERNION)
        mbl_mw_sensor_fusion_write_config(device.board)
        mbl_mw_sensor_fusion_start(device.board)
    }
    }
    }

Comments

  • I have used on bridge(obj: self) too but it doesn't work

  • edited May 2021

    Is that you entire code? Can you reformat please?
    It doesn't look like your turn on the accelerometer or anything. I think you are missing the initial settings to turn sensors on.

Sign In or Register to comment.