-
-
Notifications
You must be signed in to change notification settings - Fork 296
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
Fix rest detection timescale #305
Fix rest detection timescale #305
Conversation
Sensor fusion expects the time to be in seconds while rest detection expects it to be in microseconds. This makes is so when the update sensor fusion is called the rest detection now gets the time in micros
9ae0021
to
8c944b6
Compare
The time scale can probably be moved to |
I changed the rest detection to be in seconds instead of in microseconds like it was before. I am not able to test this. The best way to test would be see if you can still calibrate a bmi160. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested, need to change the types to sensor_real_t
, otherwise it all gets rounded and deltas become 0.
Also minor inconsistency with tabs/spaces, but we need to fix that across the whole codebase honestly.
src/motionprocessing/RestDetection.h
Outdated
@@ -20,14 +20,14 @@ | |||
struct RestDetectionParams { | |||
sensor_real_t biasClip; | |||
sensor_real_t biasSigmaRest; | |||
uint32_t restMinTimeMicros; | |||
uint32_t restMinTime; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uint32_t
-> sensor_real_t
src/motionprocessing/RestDetection.h
Outdated
@@ -235,7 +235,7 @@ class RestDetection { | |||
private: | |||
RestDetectionParams params; | |||
bool restDetected; | |||
uint32_t restTimeMicros; | |||
uint32_t restTime; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uint32_t
-> sensor_real_t
src/motionprocessing/RestDetection.h
Outdated
restDetected = false; | ||
} | ||
#endif | ||
} | ||
|
||
void updateAcc(uint32_t dtMicros, sensor_real_t acc[3]) { | ||
void updateAcc(uint32_t dt, sensor_real_t acc[3]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uint32_t
-> sensor_real_t
Sensor fusion expects the time to be in seconds while rest detection expects it to be in microseconds. This makes is so when the update sensor fusion is called the rest detection now gets the time in micros Co-authored-by: Eiren Rain <Eirenliel@users.noreply.github.com>
Sensor fusion expects the time to be in seconds while rest detection expects it to be in microseconds. This makes is so when the update sensor fusion is called the rest detection now gets the time in micros. Also linear acceleration was missing parentheses giving wrong results (only lsm6dsv uses this to my knowledge)