Announcement

Collapse

Forum Upgrade

We’re excited to announce that the Garmin Forums will soon be moving to a new platform that should greatly improve our forum experience for everyone. We will update everyone as more information becomes available.
See more
See less

Assistance Re Getting Pitch and Roll data from Sensor

Collapse
X
  • Time
  • Show
Clear All
new posts

  • Assistance Re Getting Pitch and Roll data from Sensor

    I am interested in getting Pitch and Roll data from the VivoactiveHR. I just want to get the angles as you tilt your device. From what I have seen that is pitch and roll data.

    I can get acceleration data .. but would like to get the pitch and roll data (in degrees). I assume that they would be from -180 to 180 degrees.
    Btw ... is Pitch on the x Axis and Roll on the yAxis ?

    This is what I have so far .. but think that it is wrong.

    var movement = Sensor.getInfo();

    if (movement has :accel && movement.accel != null && start == 1 and pause == 0 and bye == 0)
    {
    accel = movement.accel;
    xAccel = accel[0];
    yAccel = accel[1];
    zAccel = accel[2];


    Roll = Math.atan2(yAccel,zAccel);
    Pitch = Math.atan2( xAccel, Math.sqrt( yAccel * yAccel + zAccel * zAccel));
    }


    Any help would be appreciated. Thanks
    Kevin
    Last edited by VivoactiveHRGuy; 11-09-2018, 11:24 AM.
    HR Sleep - Measure Sleep with your Heart
    HR Always - Always your HR
    Connect IQ Apps
Working...
X