Forerunner 965 accelerometer and gyroscope access

Hi all,

I am working on creating an app for gait recognition for my research, I am trying to access accelerometer data and gyroscope data and store them into a fit file to analyse. However, I am not able to access those two sensors and I am a bit confused about what to do, I tried with something like this:

        var info = Sensor.Info;
        var keys = [];
        if (info has :accel) { keys.add("accelerometer"); }
        if (info has :gyroscope) { keys.add("gyroscope"); }
        if (info has :mag) { keys.add("magnetometer"); }
        if (info has :temperature) { keys.add("temperature"); }
        System.println("Available sensor types: " + keys.toString());

I try to print the sensors availble, as you can see, the result consists [acceletometer, magnetometer and temperrature]. 
I am generally confused about how to access those sensors and if they are activated, plus, does it has anything to do with the watch itself? I am using an Garmin Forerunner965 and I can't find any method to activate developers mode inside the watch. 

Thank you very much for your time and patience!
  • Hi.

    Try like this

    #1 options

    var options = {
    :period => 1, // 1 second sample time
    :accelerometer => {
    :enabled => true, // Enable the accelerometer
    :sampleRate => 100, // N samples
    :includePower => true,
    :includePitch => true,
    :includeRoll => true
    },
    :gyroscope => {
    :enabled => true,
    :sampleRate => 100
    }
    };
    #2 Init
    OnStart method:
    Sensor.registerSensorDataListener(method(:accelCallback1), options);
    #3 collect data
    function accelCallback1(data as $.Toybox.Sensor.SensorData) as Void {
    ...
    mX = data.accelerometerData.x;
    mY = data.accelerometerData.y;
    mZ = data.accelerometerData.z;
    pitch = data.accelerometerData.pitch;
    pow = data.accelerometerData.power;
    roll = data.accelerometerData.roll;
    gyroX = data.gyroscopeData.x; // Float in deg/sec.
    gyroY = data.gyroscopeData.y;
    gyroZ = data.gyroscopeData.z;