Giter Site home page Giter Site logo

Zeroing sensor values about mpu6050_light HOT 4 CLOSED

rfetick avatar rfetick commented on June 17, 2024
Zeroing sensor values

from mpu6050_light.

Comments (4)

rfetick avatar rfetick commented on June 17, 2024

Hello,

You cannot set to zero angleX, angleY and angleZ since they are estimations from the raw data (accelerometer and gyro). If the calibration is done correctly these values should be close to zero just after start. They can suffer from raw data measurement noise, but there is nothing to do to solve this.

If your estimated values of angleX (etc) are far from zero after calibration, you might have an issue in your calibration.

Kind regards,
Romain

from mpu6050_light.

ivanbo97 avatar ivanbo97 commented on June 17, 2024

Actually I was wondering if I can do second calibration. My initial purpose is to make my robot's front to point North which requires some additional steps because MPU6050 doesn't have magnetomer. They are as follow:

  1. Retrieve current gps coordinates.
  2. Move the robot x meters forward.
  3. Once again retrieve gps coordinates.
  4. Based on the two coordinates I use additional formula to calculate the current rotation around the z-axis (azimuth in degrees)
    For example the result is 255° and the MPU6050 initially shows 0°.
  5. I want the robot to face north (360°), so I call a function written by me: rotate(360-255);
    After function execusion the robot is facing north but MPU6050 will show rotation around z : ≈0° + (360°-255°) ≈ 105°.

Is it possible to calibrate MPU6050 once again and zero its values (especially rotation around z-axis), because thus the MPU6050 output value for rotaton around z will correspond to compass values.

from mpu6050_light.

rfetick avatar rfetick commented on June 17, 2024

OK I understand better your problem now. Your GPS data give you the absolute heading angle (based on the recipe you explained), whereas MPU6050 only provides a relative one. Both are related by an offset, so you can compute the offset and apply it to the angleZ value given by the library.

// compute offset only once
float heading_absolute = getHeadingFromGPS();
float heading_offset = heading_absolute - mpu.getAngleZ();
// now apply offset on all your measurements
float unbiased_heading = mpu.getAngleZ() + heading_offset;

You are then implicitly performing data fusion between GPS and MPU6050. Different devices provide measurements or estimates of the state of your robot, and you want to efficiently merge these data to get the "best" estimate of the state.

I might revise my opinion, but I don't think I would implement this directly inside the MPU6050 library, because it looks like data fusion with other components, that is out of the scope of the library. Its scope is only to provide the best estimate given internal data. Then the user can obviously decide to merge data as he/she likes in his/her Arduino script. I hope you understand my point.

Kind regards,

Romain

from mpu6050_light.

ivanbo97 avatar ivanbo97 commented on June 17, 2024

Quite helpful answer! Thank you for your quick response.

from mpu6050_light.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.