Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to save calibration #11

Open
gunarkroeger opened this issue Mar 5, 2021 · 1 comment
Open

How to save calibration #11

gunarkroeger opened this issue Mar 5, 2021 · 1 comment

Comments

@gunarkroeger
Copy link

How do I read the calibration from the imu, so that I can save it to an external flash and write it back onto the sensor on power up?

@gunarkroeger
Copy link
Author

These are the ways I tried, by reading the registers directly and the values from the struct. but neither update after it gets calibrated

    uint8_t reg_g_offset[6];
    uint8_t reg_a_offset[6];
    int result = 0;
    //Gyro offset
    result |= inv_icm20948_read_mems_reg(s, REG_XG_OFFS_USRH, sizeof(reg_g_offset), reg_g_offset);

    //Accel offset
    result |= inv_icm20948_read_mems_reg(s, REG_XA_OFFS_H, 2, &reg_a_offset[0]);
    result |= inv_icm20948_read_mems_reg(s, REG_YA_OFFS_H, 2, &reg_a_offset[2]);
    result |= inv_icm20948_read_mems_reg(s, REG_ZA_OFFS_H, 2, &reg_a_offset[4]);

    Serial.println("g_offset");
    for(unsigned i = 0; i < 6; i++)
        Serial.print(String(reg_g_offset[i]) + " ");

    Serial.println("");
    Serial.println("a_offset");
    for(unsigned i = 0; i < 6; i++)
        Serial.print(String(reg_a_offset[i]) + " ");
    Serial.println(String("result:") + result);

    Serial.println("bias");
    for(unsigned i = 0; i < 9; i++)
        Serial.print(String(s->bias[i]) + " ");

    Serial.println("");
    Serial.println("soft_iron_matrix");
    for(unsigned i = 0; i < 9; i++)
        Serial.print(String(s->soft_iron_matrix[i]) + " ");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant