Class: RapiroWrapper::LeftHandGrip

Inherits:
ServoMotor show all
Defined in:
lib/rapiro_wrapper/servo_motor/left_hand_grip.rb

Overview

LeftHandGrip for RAPIRO

Constant Summary collapse

NO =
7
DEFAULT =
90
MIN =
60
MAX =
110

Instance Method Summary collapse

Methods inherited from ServoMotor

code, find_servos, #to_code

Constructor Details

#initialize(hold: nil, open: nil) ⇒ LeftHandGrip

Returns a new instance of LeftHandGrip.



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/rapiro_wrapper/servo_motor/left_hand_grip.rb', line 9

def initialize(hold: nil, open: nil)
  fail ArgumentError if open && hold
  if hold
    @value = MAX - hold
  elsif open
    @value = MIN + open
  else
    @value = DEFAULT
  end
  fail ArgumentError unless @value.between?(MIN, MAX)
end