Alejo Next
Alejo Next

Reputation: 393

Accelerometer QML

Attempt to measure distance based acceleration (accelerometer mobile). If that's true

Accelerometer {
    id: accel
    dataRate: 1000 / 25
    onReadingChanged: {
        console.log(reading.x, reading.y, reading.z);
    }
}

In console

D/libsensor.so(16533): qrc:/main.qml:20 (onReadingChanged): qml: 1.359906554222107,8.791508674621582,-0.4405331015586853

Now when you display information and having the mobile completely still (motionless). Shows acceleration in all axes, which is absurd! You have any idea why?

Upvotes: 2

Views: 376

Answers (1)

Ilya
Ilya

Reputation: 5557

That's certainly not absurd.

According to Einstein's widely accepted (but still disturbing) theories, your phone can't tell if it's sitting still on planet Earth or accelerating inside a spaceship in deep space - that's called the "equivalence principle". So it's just assuming it's in an accelerating spaceship, because why not ? And that's so much cooler, don't you think ?

If you're near (or on) a planet and reading a zero acceleration, that's bad news, because that means you're freefalling in the distorted spacetime around the planet, and you're probably about to hit something.

You're reading an acceleration of about 9m/s^2, which is close to Earth's g value, so that's approximatively right, depending on your phone orientation. Maybe the accerelometer calibration is not quite right, you can test it with a dedicated application, if you've not done it already. NB Some apps will compensate for the gravity of Earth.

Of course, there's also the possibility of bugs in the phone or in Qt or in your code, or hardware failure, but you have to know what to expect.

Hope that helps.

Upvotes: 8

Related Questions