Esempio n. 1
0
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)
Esempio n. 2
0
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)

h.stop()

Esempio n. 3
0
        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))
    DecToFingerBin(number)
    time.sleep(1)

# wrist moves
#for x in range(3):
#    h.finger_tension(Humanoid.RIGHT_WRIST_ROTATION, 40)
#    time.sleep(1)
#    h.finger_tension(Humanoid.RIGHT_WRIST_ROTATION, 60)
#    time.sleep(1)

# clock
#minute = datetime.datetime.now().minute
#print("actual time (minutes): " + str(minute))