throttle.h 571 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //
  2. // Created by logicp on 4/22/17.
  3. //
  4. #ifndef DRONE_THROTTLE_H
  5. #define DRONE_THROTTLE_H
  6. namespace main_stronglogic {
  7. class throttle {
  8. public:
  9. throttle();
  10. throttle(int size);
  11. void shut_off() {
  12. position = 0;
  13. }
  14. void shift(int amount);
  15. double flow() const {
  16. return position / double(top_position);
  17. }
  18. bool is_on() const {
  19. return (position > 0);
  20. }
  21. private:
  22. int top_position;
  23. int position;
  24. };
  25. }
  26. #endif //DRONE_THROTTLE_H