probably bug at sensor fusion beta-03

Hi Eric,

I think there is probably a bug at sensor fusion by configurate the mode.

source code of configuration the sensor fusion:
boardHandRight.connectAsync().onSuccessTask(task -> {
sensorFusionHandRight = boardHandRight.getModule(SensorFusionBosch.class);
return sensorFusionHandRight.eulerAngles().addRoute(source -> {
source.log((msg, env) -> {
record.getHandRightData().addEuler(msg.timestamp(), msg.value(EulerAngle.class));
Log.i("HAND RIGHT", "EULER " + msg.formattedTimestamp() + msg.value(EulerAngle.class));
and start the logging:
sensorFusionHandRight.start(); // At this Line I have the problems
Here the message:
12-14 12:18:41.864 31188-31188/com.gaitapp.steinmetzer.gaitapp E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.gaitapp.steinmetzer.gaitapp, PID: 31188
java.lang.NullPointerException: Attempt to invoke virtual method 'int com.mbientlab.metawear.module.SensorFusionBosch$Mode.ordinal()' on a null object reference
at com.mbientlab.metawear.impl.SensorFusionBoschImpl.start(
at com.gaitapp.steinmetzer.gaitapp.fragments.InsoleFragment$7.onClick(
at android.view.View.performClick(
at android.view.View$
at android.os.Handler.handleCallback(
at android.os.Handler.dispatchMessage(
at android.os.Looper.loop(
at java.lang.reflect.Method.invoke(Native Method)
I look also in the source code from the sample app beta-03. In my Opinion you don't update this code to the beta version. Here the link:

Thank you for helping.

Best reguards


  • Sorry, that class should not be on the beta branch at the moment since, as you have pointed out, the code has not been updated yet.  We do have a demo app using a quaternion stream to rotate a cube that has working sensor fusion code, you can check that out here.  

    As for the null pointer exception, I have never encountered an npe when calling start after committing a configuration profile.  Can you check that the sensor fusion demo app linked above works for you?
  • I tested the cube demo. All works fine.
    But in this demo you use the beta-01. In my project i use the beta-03. In this version you modified many class names. I think there is propably a mistake. Because in beta-03 I can only select the class SensorFusionBosch and not the super class SensorFusion.
  • The cube demo was updated to use beta-03 a few days ago.
  • Sorry, my mistake. I checked the demo again and they run.

    I found a mistake in my code too but not the main mistake. In the last days I try some stuff but nothing work for me. Now I have build a new sampleapp based on your starter project.

    Here my sourcecode: Link

    If I stream the data the app run perfect, but if I want log the data nothing work. I hope you can help me.

  • The addRoute function is asynchronous, you need to use the Continuation object to check if the operation failed and to add the next route at the appropriate time.
  • edited January 2017

    Hi Eric,

    thank you for your fast support! Now the source code work very fine.

    P.S. version 3.x.x of the api works very well
This discussion has been closed.