Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Qml accelerometer; accelerationMode property not working?
Forum Updated to NodeBB v4.3 + New Features

Qml accelerometer; accelerationMode property not working?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
4 Posts 2 Posters 784 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lockheed
    wrote on last edited by lockheed
    #1

    I am struggling with getting clean (with excluded gravity) readings from qml Accelerometer. It's looks like accelerationMode: Accelerometer.User takes no effects at all ( even onAccelerationModeChanged is not firing). Am I supposed to write c++ Accelerometer wrapper, or algorithm extracting user movement on my own?

    Accelerometer{
     id: acc
     active: true 
     skipDuplicates: true
     accelerationMode: Accelerometer.User
    
    onReadingChanged: {
         console.log('acc x', reading.x)
         console.log("acc y", reading.y)
         console.log('acc z', reading.z)
    } }
    

    It's a bug, or my fault?

    Pablo J. RoginaP 1 Reply Last reply
    0
    • L lockheed

      I am struggling with getting clean (with excluded gravity) readings from qml Accelerometer. It's looks like accelerationMode: Accelerometer.User takes no effects at all ( even onAccelerationModeChanged is not firing). Am I supposed to write c++ Accelerometer wrapper, or algorithm extracting user movement on my own?

      Accelerometer{
       id: acc
       active: true 
       skipDuplicates: true
       accelerationMode: Accelerometer.User
      
      onReadingChanged: {
           console.log('acc x', reading.x)
           console.log("acc y", reading.y)
           console.log('acc z', reading.z)
      } }
      

      It's a bug, or my fault?

      Pablo J. RoginaP Offline
      Pablo J. RoginaP Offline
      Pablo J. Rogina
      wrote on last edited by
      #2

      @lockheed just in case, have you tried this example AccelBubble?
      In addition could you please provide more details about your environment (OS, Qt version, device where you run app, etc.)

      Upvote the answer(s) that helped you solve the issue
      Use "Topic Tools" button to mark your post as Solved
      Add screenshots via postimage.org
      Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • L Offline
        L Offline
        lockheed
        wrote on last edited by
        #3

        AccelBubble: ball is not moving at all, readings from accelerometer are the same as in my app (z is about 9-9.5, showing gravity acceleration).

        Devices:

        • Lenovo Tab A7 Android 4.4
        • LG k8 LTE Android 6.0

        Host os: Win 10 ; Qt: 5.10.1

        To show what I am complaining about, there is a small code snippet , modified accelbubble.qml file, which shows current accelerometer readings, and allow to change accelerationMode 'on the fly'. As far as I understand, changing mode from combined, to user, to gravity, should affect readings values.

        (besides modified accelbubble.qml, I put
        <uses-feature android:name="android.hardware.sensor.accelerometer" android:required="true"/> in Manifest.xml)

        1 Reply Last reply
        0
        • L Offline
          L Offline
          lockheed
          wrote on last edited by
          #4

          My fault. I didn't notice that some hardware backends isn't supporting different accelerationModes. Problem solved.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved