Bayley Wang
/
foc-ed_in_the_bot_compact
robot
Diff: ThrottleMapper/ThrottleMapper.cpp
- Revision:
- 160:6948bb7bcabd
- Parent:
- 111:451e40aed753
- Child:
- 185:5c102874b490
--- a/ThrottleMapper/ThrottleMapper.cpp Sun May 07 17:43:41 2017 +0000 +++ b/ThrottleMapper/ThrottleMapper.cpp Sat Jul 01 21:16:33 2017 +0000 @@ -48,4 +48,11 @@ w = __wmax; } return (__wmax - w) / (__wmax - __wlim) * throttle; +} + +float AutoThrottleMapper::map(float throttle, float w) { + if (throttle < 0.5f) return 0.0f; + val += 1.0f / _period / _rate; + if (val > 1.0f) val = 0.0f; + return val; } \ No newline at end of file