Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 2 of 2

Thread: Offset related to Accelerometer and Gyroscope

  1. #1

    Offset related to Accelerometer and Gyroscope


    void readMotionSensor(float& ax, float& ay, float& az, float& gx, float& gy, float& gz, float& mx, float& my, float& mz)
            if (!newdata) update();
            newdata = 0;
            ax = (float)accel_mag_raw[0] * G_PER_COUNT - cal[0];
            ay = (float)accel_mag_raw[1] * G_PER_COUNT - cal[1];
            az = (float)accel_mag_raw[2] * G_PER_COUNT - cal[2];
            gx = (float)gyro_raw[0] * DEG_PER_SEC_PER_COUNT - cal[3];
            gy = (float)gyro_raw[1] * DEG_PER_SEC_PER_COUNT - cal[4];
            gz = (float)gyro_raw[2] * DEG_PER_SEC_PER_COUNT - cal[5];
            float x = (float)accel_mag_raw[3] * UT_PER_COUNT - cal[6];
            float y = (float)accel_mag_raw[4] * UT_PER_COUNT - cal[7];
            float z = (float)accel_mag_raw[5] * UT_PER_COUNT - cal[8];
            mx = x * cal[10] + y * cal[13] + z * cal[14]; 
            my = x * cal[13] + y * cal[11] + z * cal[15];
            mz = x * cal[14] + y * cal[15] + z * cal[12];
    I am knowing that cal array value from 6th index to 15th index for magnetometer calibration and this value we can get from the MotionCal.exe. For 0th index to 5th index value are filling zero value from the MotionCal.exe. Those index getting zero values are for Accelerometer and Gyroscope.

    As per my thought this 0th to 5th index values are for offset of Accelerometer and Gyroscope. Is there any way to get these offset values for Accelerometer and Gyroscope?

    I want to know that, is it required to calibrate the Accelerometer and Gyroscope? If it required than, which way get the offset values?

    Appreciate if any input will be there related to topic.


  2. #2
    Hi Team,

    I am having unstable value of YAW, and as per my understanding it can be influenced by Magnetometer and Accelerometer. I am always getting zero values in cal[0] to cal[5] while performing rotating calibration through MotionCal.exe. Please help me to understand necessity of Accelerometer calibration, and what things I need to take care towards that direction.

    I already have seprate Teensey thread running for Magnetometer, and making chANGES accordingly.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts