Class: Rubots::Command::Throttle
- Inherits:
-
Object
- Object
- Rubots::Command::Throttle
- Defined in:
- lib/rubots/command/throttle.rb
Instance Method Summary collapse
- #apply_to(robot) ⇒ Object
- #cooldown ⇒ Object
-
#initialize(throttle) ⇒ Throttle
constructor
A new instance of Throttle.
Constructor Details
#initialize(throttle) ⇒ Throttle
Returns a new instance of Throttle.
4 5 6 7 8 |
# File 'lib/rubots/command/throttle.rb', line 4 def initialize(throttle) @throttle = throttle @throttle = 0 if @throttle < 0 @throttle = Robot::MAX_THROTTLE if @throttle > Robot::MAX_THROTTLE end |
Instance Method Details
#apply_to(robot) ⇒ Object
10 11 12 |
# File 'lib/rubots/command/throttle.rb', line 10 def apply_to(robot) robot.desired_throttle = @throttle end |
#cooldown ⇒ Object
14 15 16 |
# File 'lib/rubots/command/throttle.rb', line 14 def cooldown 5 end |