def wakeup(robot): try: robot.eyes(eyes = (0, 0)) technique = rand_in([1,2]) if technique == 1: for i in range(int(rand(70,85)))[::rand_in([3,4])]: robot.eyes(lids = (i, i)) robot.sleep(0.1) robot.eyes((rand(-90, 90), 0 )) robot.sleep(rand(0.5, 1.)) robot.eyes((rand(-90, 90), 0 )) robot.sleep(rand(0.5, 1.)) robot.eyes(eyes = (0,0), lids = Ranger.eyelids.OPEN) else: robot.eyes(left_lid = (rand(18, 25), rand(18,25))) robot.sleep(rand(0.6, 0.7)) robot.eyes(right_lid = (rand(18, 25), rand(18,25))) robot.sleep(rand(0.6, 0.7)) robot.eyes(lids = Ranger.eyelids.OPEN) except ActionCancelled: robot.eyes(eyes = (0, 0), lids = Ranger.eyelids.OPEN)
def lost(robot): try: for i in range(3): robot.eyes(rand_in([(90,90), (50, 90), (-90, 90), (-90, -90), (90, -90), (0, 90), (90, 0), (50, -50), (-50, 20)])) robot.sleep(rand(0.6, 1.2)) with EYES: robot.blink(rand_in([1,2])) while True: robot.eyes((0, -70)) robot.sleep(rand(2,5)) robot.eyes(rand_in([(90,90), (50, 90), (-90, 90), (-90, -90), (90, -90), (0, 90), (90, 0), (50, -50), (-50, 20)])) robot.sleep(rand(1.6, 2)) with EYES: robot.blink(rand_in([1,2])) except ActionCancelled: robot.eyes((0, 0)) robot.eyes(lids = Ranger.eyelids.OPEN)
def fall_asleep(robot): try: for i in range(int(rand(70,85)))[::rand_in([3,4])]: robot.eyes(lids = (100 - i, 100 - i)) robot.sleep(0.1) robot.eyes((rand(-90, 90), 0 )) robot.sleep(rand(0.6, 1.5)) robot.eyes(eyes = (0,0), lids = Ranger.eyelids.CLOSED) except ActionCancelled: robot.eyes(eyes = (0, 0), lids = Ranger.eyelids.OPEN)
def idle(robot): try: while True: robot.sleep(rand(5, 10)) if not robot.state.asleep: val = rand_in([-75,-60, 60, 75]) robot.placeeyes((val, 0)) robot.sleep(1) robot.placeeyes((0, 0)) except ActionCancelled: robot.eyes(eyes = (0, 0))
def active_wait(robot): try: robot.idle() while True: eyes = rand_in(range(4)) if eyes == 1: robot.sneak_in() robot.turn(rand(0.3, 0.7)).wait() robot.sleep(1) robot.turn(-2 * rand(0.3, 0.7)).wait() robot.sleep(1) robot.turn(rand(0.3, 0.7)).wait() robot.sleep(rand(5,10)) except ActionCancelled: pass