IMU support in firmware#42
Open
MoridinBG wants to merge 17 commits into
Open
Conversation
Two step calibration, independent from sensor orientation on bike. First finds the direction of gravity is found with the bike standing on level ground. Then the bike is lifted on its rear tire with the front in the air and the forward direction is calculated. Take care in this step not to tilt the bike to the sides
My unit's SPI is broken and gives garbage data, so tested only over I2C
It's an old design so sensitivity is low, it is noisy, temp stability is bad and temp calibration is hard, but hey, it is very cheap!
Define optional fork, frame & rear IMUs over I2C/SPI
… for the required hardware in debug & release
Contributor
Author
Also make the IMU buffer size dynamic, based on the number of enabled IMUs, as each entry is 6 int16
…, number of records, sample rates
This file contains hidden or 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
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 PR implements support for IMUs with a generic interface in
imu_sensorand hardware specific implementations for LSM6DSO & MPU6050.It defines 3 IMU positions - fork lowers, frame, rear axle.
It has the firmware changes from https://github.com/MoridinBG/sst/tree/firmware/tlv-file with some additional comments and renamings, without the dashboard changes.
It implements the same two step IMU calibration flow as described in the issue:
After these two steps, the sensor is oriented so that when the bike is static:
With this implementation, gravity is not removed - when bike is static on level ground the Z vector will read 1.00 (+/- noise), while X & Y are 0.00
There is an implementation for readings interpretation that is useful for debugging, but the forces from the ground, pedalling, breaking, shifting weight make it very unstable.
Data while in motion needs a very different approach.