def sad(self): print("Display sad expression") servos.setMovementFrame(0.1) servos.setServoPosition(MOUTH, 50) # mouth close servos.setServoPosition(EYEBROW_L, 70) # eyebrow low servos.setServoPosition(EYEBROW_L, 70) # eyebrow low servos.setServoPosition(EYE_VERTICAL, 60) # eyes down servos.beginMotion() time.sleep(4) self.reset()
def reset(self): print("Face reset...") servos.setMovementFrame(0) servos.setServoPosition(EYEBROW_R, 80) # eyebrow flat servos.setServoPosition(EYEBROW_L, 80) # eyebrow flat servos.setServoPosition(EYELID_R, 60) # eye open servos.setServoPosition(EYELID_L, 60) # eye open servos.setServoPosition(EYE_HORIZONTAL, 80) # eye center servos.setServoPosition(EYE_VERTICAL, 70) # eye center servos.setServoPosition(MOUTH, 20) # mouth close servos.beginMotion()
def bangSticks(self): servos.setServoPosition(ARM_UPDOWN_L, 70) # arm up servos.setServoPosition(ARM_UPDOWN_R, 70) # arm up servos.setServoPosition(ELBOW_L, 140) # elbow up servos.setServoPosition(ELBOW_R, 30) # elbow up servos.beginMotion() servos.setServoPosition(ARM_ROTATE_L, 65) # arm in servos.setServoPosition(ARM_ROTATE_R, 60) # arm in servos.beginMotion() servos.setServoPosition(ELBOW_L, 100) # elbow down servos.setServoPosition(ELBOW_R, 120)
def excited(self): print("Display excited expression") servos.setMovementFrame(0.1) servos.setServoPosition(MOUTH, 50) # mouth open servos.setServoPosition(EYEBROW_R, 90) # eyebrow up servos.setServoPosition(EYEBROW_L, 90) # eyebrow up servos.setServoPosition(EYE_HORIZONTAL, 80) # eye center servos.setServoPosition(EYELID_R, 60) # eye open servos.setServoPosition(EYELID_L, 60) # eye open servos.beginMotion() time.sleep(2) self.reset()
def bangDrumLeft(self): print("Bang Left Drum") servos.setMovementFrame(0) servos.setServoPosition(ELBOW_L, 140) # elbow up servos.beginMotion() servos.setServoPosition(ARM_ROTATE_L, 65) # arm in servos.setServoPosition(ARM_UPDOWN_L, 100) # arm up servos.beginMotion() servos.setServoPosition(ELBOW_L, 105) # elbow down servos.beginMotion() servos.setServoPosition(ELBOW_L, 140) # elbow up servos.beginMotion()
def bangDrumRight(self): print("Bang Right Drum") servos.setMovementFrame(0) servos.setServoPosition(ARM_ROTATE_R, 55) # arm in servos.setServoPosition(ELBOW_R, 30) # elbow up servos.setServoPosition(ARM_UPDOWN_R, 55) # arm up servos.beginMotion() servos.setServoPosition(ELBOW_R, 80) # elbow down servos.beginMotion() servos.setServoPosition(ELBOW_R, 30) # elbow up servos.beginMotion()
def flirt(): print("Bot Interaction: Flirt") servos.setServoPosition(EYE_HORIZONTAL, 80) # eye center speak("Well. Hello there, good looking.", "Flirt.mp3") arms.bangDrumLeft() arms.bangDrumLeft() servos.setServoPosition(EYE_HORIZONTAL, 100) # eye right servos.beginMotion() servos.setServoPosition(EYE_VERTICAL, 60) # eye left servos.beginMotion() servos.setServoPosition(MOUTH, 50) # mouth close servos.setServoPosition(EYE_HORIZONTAL, 80) # eye center servos.beginMotion()
def reset(self): print("Arm reset...") servos.setMovementFrame(0) servos.setServoPosition(ELBOW_R, 50) # elbow up servos.setServoPosition(ELBOW_L, 140) # elbow up servos.beginMotion() time.sleep(.5) servos.setServoPosition(ARM_ROTATE_R, 55) #arm in servos.setServoPosition(ARM_ROTATE_L, 60) #arm in servos.beginMotion() time.sleep(.5) servos.setServoPosition(ARM_UPDOWN_R, 50) # arm relax servos.setServoPosition(ARM_UPDOWN_L, 70) # arm relax servos.beginMotion()
def angry(self): print("Display angry expression") servos.setMovementFrame(0.1) servos.setServoPosition(MOUTH, 50) # mouth close servos.setServoPosition(EYE_VERTICAL, 70) # eyes down servos.setServoPosition(EYEBROW_R, 50) # eyebrow down servos.setServoPosition(EYEBROW_L, 50) # eyebrow down servos.setServoPosition(EYE_HORIZONTAL, 60) servos.beginMotion() servos.setServoPosition(EYE_HORIZONTAL, 60) # eye left servos.beginMotion() servos.setServoPosition(EYE_HORIZONTAL, 100) # eye right servos.beginMotion() servos.setServoPosition(EYE_HORIZONTAL, 80) # eye center self.reset()
def mouthOpen(self): servos.setMovementFrame(0) servos.setServoPosition(MOUTH, 50) # mouth open servos.beginMotion()
def mouthClose(self): servos.setMovementFrame(0) servos.setServoPosition(MOUTH, 20) # mouth close servos.beginMotion()
def armCelebration(self): print("Arm Celebration") #arms ready arms.reset() time.sleep(1) # RIGHT ARM # right arm high/out and back servos.setServoPosition(ELBOW_R, 30) # elbow up servos.setServoPosition(ARM_UPDOWN_R, 55) # arm center servos.setServoPosition(ARM_ROTATE_R, 60) # arm in servos.beginMotion() #arm out servos.setServoPosition(ARM_ROTATE_R, 100) # arm out servos.beginMotion() #elbow down servos.setServoPosition(ELBOW_R, 120) servos.beginMotion() #elbow up servos.setServoPosition(ELBOW_R, 30) servos.beginMotion() #arm in servos.setServoPosition(ARM_ROTATE_R, 60) # arm in servos.beginMotion() #arm out servos.setServoPosition(ARM_ROTATE_R, 100) # arm out servos.beginMotion() #arm in servos.setServoPosition(ARM_ROTATE_R, 60) # arm in servos.beginMotion() # LEFT ARM # left arm high/out and back servos.setServoPosition(ELBOW_L, 140) # elbow up servos.setServoPosition(ARM_UPDOWN_L, 100) # arm center servos.setServoPosition(ARM_ROTATE_L, 65) # arm in servos.beginMotion() #arm out servos.setServoPosition(ARM_ROTATE_L, 40) # arm out servos.beginMotion() #elbow down servos.setServoPosition(ELBOW_L, 100) # elbow down servos.beginMotion() #elbow up servos.setServoPosition(ELBOW_L, 140) # elbow up servos.beginMotion() #arm in servos.setServoPosition(ARM_ROTATE_L, 65) # arm in servos.beginMotion() #arm out servos.setServoPosition(ARM_ROTATE_L, 40) # arm out servos.beginMotion() #arm in servos.setServoPosition(ARM_ROTATE_L, 65) # arm in servos.beginMotion()
def MainTest(): time.sleep(0.8) print("Running main test") servos.setMovementFrame(0) arms.reset() # Test audio output speak( 'I am running a test on my body! If my movement is not matched to my words, it means something is broken!', "Diagnostic.mp3") time.sleep(TEST_SLEEP_TIME) speak("right eyebrow up", "right_eyebrow_up.mp3") servos.setServoPosition(EYEBROW_R, 100) servos.beginMotion() speak("right eyebrown down", "right_eyebrow_down.mp3") servos.setServoPosition(EYEBROW_R, 50) servos.beginMotion() speak("right eyebrow flat", "right_eyebrow_flat.mp3") servos.setServoPosition(EYEBROW_R, 80) servos.beginMotion() speak("left eyebrow up", "left_eyebrow_up.mp3") servos.setServoPosition(EYEBROW_L, 100) servos.beginMotion() speak("left eyebrow down", "left_eyebrow_down.mp3") servos.setServoPosition(EYEBROW_L, 50) servos.beginMotion() speak("left eyebrow flat", "left_eyebrow_flat.mp3") servos.setServoPosition(EYEBROW_L, 80) servos.beginMotion() #speak("eyes close", "eyes_close.mp3") #servos.setServoPosition(servoID, pos) #servos.beginMotion() #speak("eyes open", "eyes_open.mp3") #servos.setServoPosition(servoID, pos) #servos.beginMotion() speak("mouth open", "mouth_open.mp3") servos.setServoPosition(MOUTH, 50) servos.beginMotion() speak("mouth close", "mouth_close.mp3") servos.setServoPosition(MOUTH, 20) servos.beginMotion() speak("right shoulder up", "right_shoulder_up.mp3") servos.setServoPosition(ARM_UPDOWN_R, 30) servos.beginMotion() speak("right shoulder down", "right_shoulder_down.mp3") servos.setServoPosition(ARM_UPDOWN_R, 70) servos.beginMotion() speak("left shoulder up", "left_shoulder_up.mp3") servos.setServoPosition(ARM_UPDOWN_L, 90) servos.beginMotion() speak("left shoulder down", "left_shoulder_down.mp3") servos.setServoPosition(ARM_UPDOWN_L, 50) servos.beginMotion() speak("right arm out", "right_arm_out.mp3") servos.setServoPosition(ARM_ROTATE_R, 80) servos.beginMotion() speak("right elbow down", "right_elbow_down.mp3") servos.setServoPosition(ELBOW_R, 90) servos.beginMotion() speak("right elbow up", "right_elbow_up.mp3") servos.setServoPosition(ELBOW_R, 30) servos.beginMotion() speak("right arm in", "right_arm_in.mp3") servos.setServoPosition(ARM_ROTATE_R, 30) servos.beginMotion() #recenter the arm servos.setServoPosition(ARM_ROTATE_R, 55) speak("left arm out", "left_arm_out.mp3") servos.setServoPosition(ARM_ROTATE_L, 50) servos.beginMotion() speak("left elbow down", "left_elbow_down.mp3") servos.setServoPosition(ELBOW_L, 100) servos.beginMotion() speak("left elbow up", "left_elbow_up.mp3") servos.setServoPosition(ELBOW_L, 120) servos.beginMotion() speak("left arm in", "left_arm_in.mp3") servos.setServoPosition(ARM_ROTATE_L, 65) servos.beginMotion() #recenter the arm servos.setServoPosition(ARM_ROTATE_L, 65) servos.beginMotion() speak("Bang right drum", "bang_right_drum.mp3") arms.bangDrumRight() speak("Bang left drum", "bang_left_drum.mp3") arms.bangDrumLeft() speak("Play music!", "music.mp3") playMusic()