diff options
| author | JacobPalecki <[email protected]> | 2020-09-22 19:59:47 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-09-22 19:59:47 -0700 |
| commit | 77f420cf45a1a0bee00602965e687097367e2a70 (patch) | |
| tree | fa088af8f2feb54df5bcb6a036715fd32d0511e8 /common/accel-sigmoidgain.hpp | |
| parent | Merge pull request #21 from JacobPalecki/GUI (diff) | |
| parent | Update credits (diff) | |
| download | rawaccel-77f420cf45a1a0bee00602965e687097367e2a70.tar.xz rawaccel-77f420cf45a1a0bee00602965e687097367e2a70.zip | |
Merge pull request #22 from JacobPalecki/GUI
Replace SigmoidGain with Motivity & Cleanup
Diffstat (limited to 'common/accel-sigmoidgain.hpp')
| -rw-r--r-- | common/accel-sigmoidgain.hpp | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/common/accel-sigmoidgain.hpp b/common/accel-sigmoidgain.hpp deleted file mode 100644 index bed2f16..0000000 --- a/common/accel-sigmoidgain.hpp +++ /dev/null @@ -1,34 +0,0 @@ -#pragma once - -#include <math.h> - -#include "accel-base.hpp" - -namespace rawaccel { - - /// <summary> Struct to hold sigmoid (s-shaped) gain implementation. </summary> - struct sigmoidgain_impl { - double rate; - double limit; - double additive_constant; - double integration_constant; - - sigmoidgain_impl(const accel_args& args) : - rate(args.rate), limit(args.limit - 1) - { - additive_constant = exp(rate * args.midpoint); - integration_constant = log(1 + additive_constant); - } - - inline double operator()(double speed) const { - //f(x) = k/(1+e^(-m(c-x))) - double scaled_speed = rate * speed; - return limit * ((log(additive_constant+exp(scaled_speed)) - integration_constant)/scaled_speed); - } - - inline double legacy_offset(double speed) const { return operator()(speed); } - }; - - using accel_sigmoidgain = additive_accel<sigmoidgain_impl>; - -} |