-
-
Notifications
You must be signed in to change notification settings - Fork 60
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
pbio/imu: Implement 3D attitude and fusion of IMU data. #270
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
These flags will later be used to test which calibration has been done already. We can use the same flag to optionally set settings, rather than use NAN to indicate nothing set.
Since this is done in quite a few functions, this should make the build size smaller and the code easier to follow.
Since this is done in quite a few functions, this should make the build size smaller and the code easier to follow.
When the hub first boots, it is good to have an initial value for the bias to help suppress drift during the first nonstationary seconds. As an estimate, we can use the bias first saved on the previous boot.
When starting from the latest sample as we did before, the odds are higher that we start on an outlier and have to restart, or allow larger errors.
Now that it is a bit less sensitive to outliers, we can reduce this value. See pybricks/support#1105
To get this over the line, perhaps we should restore 1D heading and also keep the original heading correction setting available since people are using it. (In addition to the new 3D stuff). We can make the 3D-based heading the default as it gets more testing organically, instead of having it sit here as a pull request for a long time. |
This way we can introduce the feature gradually, defaulting to the current 1D behavior.
This makes the calibration user routine simpler, so we can do everything from raw data.
Not all hubs will need all modules.
This allows model-specific correction when calibration doesn't fully cover it, which is particularly useful in hubs mounted at a slight tilt.
For example, Technic Hub does not need light matrix code. Also remove single-axis calibration routine. To be replaced with 3D calibration routine.
This works on Prime Hub, Technic Hub, and Essential Hub, but the instructions are still specific to Prime Hub.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an exciting update that implements 3D attitude estimation for the gyro with fusion of accelerometer data.
The main changes:
hub.imu.heading()
. Now heading will still be close to the correct value when you drive across ramps or lift it from the table.hub.imu.tilt()
to use the new fused gyro data. This should be much less noisy than the pure accelerometer result, and it is no longer affected by horizontal or vertical acceleration.hub.imu.orientation()
which gives you the rotation matrix of your robot. This is almost always more useful than some kind of (non-)singular angular representation. We'll add some examples to show why this is useful. You could always extract your favorite angular representation from the rotation matrix elements.Things that still need to be done:
hub.imu.update_heading_calibration()
with an interactive routine that estimates the 3D calibration constants.Other notes: