Skip to content

Add calibration feature to determine "zero" position offsets #2

Open
@sandeepmistry

Description

@sandeepmistry

Suggested by @tigoe:

I'd do the calibration as a library function if we can. If people can call it in setup and know that the offset variables are available, it's more likely it'll get used. If not that, then I'd do one calibrate example, but not put it in every example unless the example needs it. We already have a few examples with too much stuff in them (see WiFi) so I'm all for keeping them simple when possible.

I think we can add the following:

// determine the accelerometer and gyro zero position offsets
// read data continuously for N milliseconds. The boards is expected
// to be lying flat. The calibrate values will not be persisters
IMU.calibrate(int ms);

// get offsets
IMU.getGyroOffsets(int& x, int& y, int& z);
IMU.getAccelerometerOffsets(int& x, int& y, int& z);

// set offsets
IMU.setGyroOffsets(int& x, int& y, int& z);
IMU.setAccelerometerOffsets(int& x, int& y, int& z);

I've added the getters and setting in the proposal above, for if someone wants to manually calibrate once and then persist elsewhere like an SD card.

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions