Class: RapiroWrapper::RightHandGrip

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

Overview

RightHandGrip class for RAPIRO

Constant Summary collapse

NO =
4
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) ⇒ RightHandGrip

Returns a new instance of RightHandGrip.



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

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