diff options
| author | Jacob Palecki <[email protected]> | 2020-09-02 21:13:18 -0700 |
|---|---|---|
| committer | Jacob Palecki <[email protected]> | 2020-09-02 21:13:18 -0700 |
| commit | 0b50f9c85568e5b8b6ee32e40990e39cfdf515b5 (patch) | |
| tree | f921f780360640e3bedf676e076496f5ff821163 /common/accel-naturalgain.hpp | |
| parent | Merge remote-tracking branch 'upstream/master' into master (diff) | |
| download | rawaccel-0b50f9c85568e5b8b6ee32e40990e39cfdf515b5.tar.xz rawaccel-0b50f9c85568e5b8b6ee32e40990e39cfdf515b5.zip | |
Start adding gain offsets
Diffstat (limited to 'common/accel-naturalgain.hpp')
| -rw-r--r-- | common/accel-naturalgain.hpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/common/accel-naturalgain.hpp b/common/accel-naturalgain.hpp index 646b2bb..03d749f 100644 --- a/common/accel-naturalgain.hpp +++ b/common/accel-naturalgain.hpp @@ -13,6 +13,11 @@ namespace rawaccel { inline double operator()(double speed) const { // f(x) = k((e^(-mx)-1)/mx + 1) + if (speed <= 0) + { + return 0; + } + double scaled_speed = rate * speed; return limit * (((exp(-scaled_speed) - 1) / scaled_speed) + 1); } |