• AGmagtest1.js

    The attached program AGmagtest.js uses the LSM9DS1.js module and the preceding calibrations to produce data in engineering units.

    The variable autocalc controls the type of units displayed.

    //autocalc 0=raw, 1=raw-offset, 2 Engineering Units
    var autocalc=2;

    In the function setupAG() the gyro ODR determines if gyro data are available.

    W.AGwrite(W.REGval.ODR_G,1);//do gyro and acceleration
    //W.AGwrite(W.REGval.ODR_G,0);//do acceleration only.

    Here is sample output with autocalc=2 and ODR_G=1

    M magnetometer values are in Gauss,
    G gyroscope values are in degrees per second
    A acceleration values are in g, (1= Earth gravity)

    M,0.0150,-0.0847,-0.1949,G,0.3582,-0.105­7,-0.1222,A,0.0839,-0.0478,0.9993,
    M,0.0172,-0.0830,-0.1933,G,0.3358,-0.158­1,-0.1297,A,0.0869,-0.0552,1.0039,
    M,0.0172,-0.0830,-0.1933,G,0.3433,-0.165­5,-0.1297,A,0.0841,-0.0479,1.0000,
    M,0.0172,-0.0830,-0.1933,G,0.3807,-0.105­7,-0.1222,A,0.0831,-0.0438,0.9987,
    M,0.0151,-0.0866,-0.1965,G,0.4031,-0.210­4,-0.1222,A,0.0817,-0.0398,0.9956,
    M,0.0151,-0.0866,-0.1965,G,0.3807,-0.083­3,-0.1222,A,0.0821,-0.0416,0.9960,
    M,0.0151,-0.0866,-0.1965,G,0.4031,-0.187­9,-0.1147,A,0.0831,-0.0460,0.9991,
    M,0.0162,-0.0845,-0.1933,G,0.3732,-0.098­2,-0.1446,A,0.0822,-0.0459,1.0009,
    M,0.0162,-0.0845,-0.1933,G,0.3059,-0.113­2,-0.1297,A,0.0834,-0.0461,1.0031,
    >clearInterval();
    
    Changing ODR_G to 0 produces:
    M,0.0154,-0.0826,-0.1849,A,0.0864,-0.051­6,1.0014,
    M,0.0154,-0.0826,-0.1849,A,0.0868,-0.053­7,1.0017,
    M,0.0154,-0.0826,-0.1849,A,0.0858,-0.054­9,1.0009,
    M,0.0154,-0.0826,-0.1849,A,0.0862,-0.056­7,1.0032,
    M,0.0154,-0.0826,-0.1849,A,0.0861,-0.059­4,1.0028,
    M,0.0154,-0.0826,-0.1849,A,0.0852,-0.059­8,1.0009,
    M,0.0154,-0.0826,-0.1849,A,0.0883,-0.060­1,0.9992,
    M,0.0154,-0.0826,-0.1849,A,0.0877,-0.057­4,0.9964,
    >clearInterval();
    

    1 Attachment

About