class BirdbrainFinchOutput
Public Class Methods
motors(device, left_speed, right_speed)
click to toggle source
# File lib/birdbrain/birdbrain_finch_output.rb, line 22 def self.motors(device, left_speed, right_speed) calc_left_speed = bounds(left_speed, -100, 100) calc_right_speed = bounds(right_speed, -100, 100) request_status(response_body('hummingbird', 'out', 'wheels', device, calc_left_speed, calc_right_speed)) end
move(device, direction, distance, speed)
click to toggle source
# File lib/birdbrain/birdbrain_finch_output.rb, line 5 def self.move(device, direction, distance, speed) calc_direction = 'Forward' if direction == BirdbrainFinch::FORWARD calc_direction = 'Backward' if direction == BirdbrainFinch::BACKWARD calc_distance = bounds(distance, -10000, 10000) calc_speed = bounds(speed, 0, 100) request_status(response_body('hummingbird', 'out', 'move', device, calc_direction, calc_distance, calc_speed)) end
reset_encoders(device)
click to toggle source
# File lib/birdbrain/birdbrain_finch_output.rb, line 33 def self.reset_encoders(device) request_status(response_body('hummingbird', 'out', 'resetEncoders', device)) end
stop(device)
click to toggle source
# File lib/birdbrain/birdbrain_finch_output.rb, line 29 def self.stop(device) request_status(response_body('hummingbird', 'out', 'stopFinch', device)) end
turn(device, direction, angle, speed)
click to toggle source
# File lib/birdbrain/birdbrain_finch_output.rb, line 14 def self.turn(device, direction, angle, speed) calc_direction = calculate_left_or_right(direction) calc_angle = bounds(angle, 0, 360) calc_speed = bounds(speed, 0, 100) request_status(response_body('hummingbird', 'out', 'turn', device, calc_direction, calc_angle, calc_speed)) end