# uncomment one part at a time to try import time from inmoov.Humanoid import Humanoid from inmoov.PwmHatHumanoid import PwmHatHumanoid h = PwmHatHumanoid() h.initialize() h.reset_all_servos() # bad stuff, don't run this ;) #h.finger_tension(Humanoid.RIGHT_FINGER_MIDDLE, position = 100) # thumb tremor #h.finger_tension(Humanoid.RIGHT_FINGER_THUMB, position = 100) #for x in range(7): # h.finger_tension_delta(Humanoid.RIGHT_FINGER_THUMB, direction = Humanoid.DIR_TIGHTEN, delta = 10) # time.sleep(1) # decimal counting #while True: #for number in range(5): #print('Actual number: '+str(number)) for i in range(5): print('Digit: ' +str(i)) h.finger_tension([i], 90) time.sleep(1) h.finger_tension([i], 30) time.sleep(1)
import time import datetime from inmoov.Humanoid import Humanoid from inmoov.PwmHatHumanoid import PwmHatHumanoid h = PwmHatHumanoid() def DecToFingerBin(number): for i in range(5): if (number/(2**i))&1 == 1: h.finger_tension([i], 85) else: h.finger_tension([i], 15) #while True: # h.pwm.set_pwm(8, 0, 4000) # print("aa") # time.sleep(1) # h.pwm.set_pwm(8, 0, 0) # print("bb") # time.sleep(1) while True: h.initialize() h.reset_all_servos() # binary counting for number in range(32): # print('Actual number: '+str(number)) DecToFingerBin(number) time.sleep(1)
from inmoov.Humanoid import Humanoid from inmoov.PwmHatHumanoid import PwmHatHumanoid h = PwmHatHumanoid() h.initialize() h.reset_all_servos() print 'Preparing...' # TODO: flush output h.finger_tension(Humanoid.RIGHT_FINGERS, position = 50) end = False step = 10 print 'Commands:' print 'q e r t y u ---> tighter - ---> smaller step' print '^ d f g h j ---> middle position + ---> bigger step' print '| c v b n m ---> looser' print '| ^ ^ ^ ^ ^' print 'exit | | | | |' print ' | | | | +--> pinky' print ' | | | +-----> ring' print ' | | +--------> middle' print ' | +-----------> index' print ' +--------------> thumb' while not end: print "Step = %d, Fingers' positions: %d, %d, %d, %d, %d" % (step, h.servoPWM[0], h.servoPWM[1], h.servoPWM[2], h.servoPWM[3], h.servoPWM[4]) key = raw_input('> Command, master?') if key == 'q': end = True elif key == 'e': h.finger_tension_delta(Humanoid.RIGHT_FINGER_THUMB, delta = -step)
# uncomment one part at a time to try import time import datetime from inmoov.Humanoid import Humanoid from inmoov.PwmHatHumanoid import PwmHatHumanoid h = PwmHatHumanoid() h.initialize() h.reset_all_servos() def DecToFingerBin(number): for i in range(5): if (number/(2**i))&1 == 1: h.finger_tension([i], 85) else: h.finger_tension([i], 15) # bad stuff, don't run this ;) #h.finger_tension(Humanoid.RIGHT_FINGER_MIDDLE, position = 100) # thumb tremor #h.finger_tension(Humanoid.RIGHT_FINGER_THUMB, position = 100) #for x in range(7): # h.finger_tension_delta(Humanoid.RIGHT_FINGER_THUMB, direction = Humanoid.DIR_TIGHTEN, delta = 10) # time.sleep(1) # binary counting h.finger_tension(Humanoid.RIGHT_WRIST_ROTATION, 50) for number in range(32): print('Actual number: '+str(number))