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

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

Open
sandeepmistry opened this issue Jul 25, 2019 · 1 comment
Open

Comments

@sandeepmistry
Copy link
Contributor

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?

@tigoe
Copy link

tigoe commented Jul 25, 2019

Seems reasonable to me. Since the sensor doesn't support it, this seems like a reasonable backup approach.

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

2 participants