Delay on SensorFusion

Hi

It seems like there is a delay, or an adjustment period so to speak, when reading from the SensorFusion.
I am logging Euler Angles whenever I press the push button and then download it later. I experience a sort of delay on my readings, as if the sensor only adjust it's values a tiny bit every time it is read from.

I am using the roll axis for this example, but the same goes for all axis:
When laying the device flat on a table, i get a roll-value very close to 0° as expected. Then when I tilt it along the roll-axis to 90° and read the value I see a little increment, but very close to 0°. Keeping the device at the 90° angle and then reading the sensor again i get yet another small increment. With every reading from the sensor the value is incremented a little bit until it reaches the approximately 90°.

It takes several readings before the value "catches up" to the actual position of the device.

Is a just how the sensor is or has it something to do with my code?

Below is the code where I controll the logging (the sensorFusion has been configured to NDOF, nothing else):

 metawear.getModule(Switch.class).state().addRouteAsync(new RouteBuilder() {
            @Override
            public void configure(RouteComponent source) {
                source.filter(Comparison.NEQ, 0).react(new RouteComponent.Action() {
                    @Override
                    public void execute(DataToken token) {
                        led.editPattern(Led.Color.BLUE, Led.PatternPreset.SOLID).commit();
                        led.play();
                        // Log Data
                        logging.start(true);
                        sensorFusion.eulerAngles().start();
                        sensorFusion.start();
                    }
                });
            }
        }).onSuccessTask(new Continuation<Route, Task<Route>>() {
            @Override
            public Task<Route> then(Task<Route> task) throws Exception {
                return metawear.getModule(Switch.class).state().addRouteAsync(new RouteBuilder() {
                    @Override
                    public void configure(RouteComponent source) {
                        source.filter(Comparison.NEQ, 1).react(new RouteComponent.Action() {
                            @Override
                            public void execute(DataToken token) {
                                led.stop(true);
                                // Stop Log
                                sensorFusion.eulerAngles().stop();
                                sensorFusion.stop();
                                logging.stop();
                            }
                        });
                    }
                });
            }
        });

Comments

  • Don't repeatedly start/stop the sensor fusion algorithm. Start it once and only stop it once you are done collecting data.

  • Thank you. How long can I expect the battery to last if the sensor fusion algorithm is running, is it just hours or is it days?

  • edited March 2018

    How long are you running the sensor fusion algorithm for each data session? How many sessions are you doing per day?

  • What I want to accomplish is to log a single reading of the Euler angles at every button press (hence my other post https://mbientlab.com/community/discussion/comment/6182#Comment_6182). The button will be pressed multiple times a day, but when it will happen is unknown and how many times is also unknown.

    If the sensor algorithm is running all day I would expect the battery do die off quickly?

    What is the best approach to achieve this goal?

  • Yeah, running the algorithm all day will drain the the battery way faster than sporadically running it. Given that, you can probably make your original code work by letting the sensor fusion generate several samples and only recording the last sample.

Sign In or Register to comment.