Class: Rubots::Command::Throttle

Inherits:
Object
  • Object
show all
Defined in:
lib/rubots/command/throttle.rb

Instance Method Summary collapse

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

#cooldownObject



14
15
16
# File 'lib/rubots/command/throttle.rb', line 14

def cooldown
  5
end