Use metawear in Unity

Hi, i just got the metawear and i want to use the sensorfusion Euler angles (or Quaternion) to stream its orientation to an object in Unity. I know there is no support/tutorial for Unity (yet?), but i saw in other posts made by @jimjam and @tpitman that my idea is possible. I already tried the suggestions in this community regarding Unity. I also bought the asset BLE for Unity. But I am really struggeling, since i dont have much programming experience in C# or C++. Could someone please help me out here. The only thing i need is to get the sensorfusion data and stream them to unity. Thanks in advance!

Kind regards,
Pieter

Comments

  • I have set up a TCP client/server so i can stream the data to Unity. Can someone tell me how to access the data in the following method (used from C# tutorials):

     protected async override void OnNavigatedTo(NavigationEventArgs e) {
            base.OnNavigatedTo(e);
    
            metawear = MbientLab.MetaWear.Win10.Application.GetMetaWearBoard(e.Parameter as 
            BluetoothLEDevice);
            sensorFusion = metawear.GetModule<ISensorFusionBosch>();
            sensorFusion.Configure();
    
            var cali = await sensorFusion.ReadCalibrationStateAsync();
            System.Diagnostics.Debug.WriteLine("Cali :" + cali);
    
            await sensorFusion.EulerAngles.AddRouteAsync(source =>
            source.Stream(async data => await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.High, () 
            =>
            {
                textBox1.Text = data.Value<EulerAngles>().ToString();
    
    
            })));
    

    Some help here would be really appreciated!

  • var value = data.Value<EulerAngles>();
    
Sign In or Register to comment.