To reduce "sampling rate" in SensorFusion

Hello,
I want to create and download raw sensor data of 3 sensors ( correctedAngularVelocity(), eulerAngles(), linearAcceleration() ) in SensorFusion for more than 12 hours.

But, the Battery is so fast drained.
So, I would like to reduce the 3 sensors' sampling rate from 100Hz/sec to 50Hz/sec.

"limit" function is not appropriately working (see below)

...
        sensorFusion.linearAcceleration().addRouteAsync(new RouteBuilder() {
            @Override
            public void configure(RouteComponent source) {
                source
                        .limit(20)
                        .stream(new Subscriber() {
                    @Override
                    public void apply(Data data, Object... env) {
...

I also try to the below code instead, but the sampling rate is not reduced..

...
        sensorFusion.linearAcceleration().addRouteAsync(new RouteBuilder() {
            @Override
            public void configure(RouteComponent source) {
                source.limit(20);
                source
                        .stream(new Subscriber() {
                    @Override
                    public void apply(Data data, Object... env) {
...

are there any mistakes that I made?

Comments

  • edited October 2018

    Try with 15ms instead of 20ms.

    The first snippet is the correct usage of the Route interface.

  • Thanks, 11ms is my parameter to set 'sampling rate 50Hz'
    I am just curious about why the sampling rate have big fluctuations with 'limit parameters'
    Thanks any way Eric :-)

This discussion has been closed.