def fear_gesture(robot): base_vel_fast_m = robot.base.params['motion']['fast']['vel_m'] base_accel_fast_m = robot.base.params['motion']['fast']['accel_m'] print("Doing gestures now...") # robot.startup() robot.head.move_to('head_pan', 3.1) robot.base.translate_by(x_m=-0.5, v_m=base_vel_fast_m, a_m=base_accel_fast_m) robot.lift.move_to(x_m=0.8) robot.arm.move_to(x_m=0.5) robot.push_command() time.sleep(3) robot.base.translate_by(x_m=-0.2, v_m=base_vel_fast_m, a_m=base_accel_fast_m) robot.lift.move_to(x_m=0) robot.arm.move_to(x_m=0.2) robot.push_command() time.sleep(4) # robot.stow() # robot.stop() return
def dance21(robot): robot.head.move_to('head_pan', -xpan, Vrpan, Arpan) robot.arm.move_to(0.5) robot.lift.move_to(0.9, Vmlift, amlift) robot.head.move_to('head_tilt', xtilt, Vrtilt, Artilt) robot.base.translate_by(0.2, Vmbasetranslate, ambasetranslate) robot.push_command()
def dance23(robot): robot.head.move_to('head_tilt', 0, Vrtilt, Artilt) robot.head.move_to('head_pan', xpan, Vrpan, Arpan) robot.arm.move_to(0.5, Vmarm, amarm) robot.lift.move_to(0.9, Vmlift, amlift) robot.base.rotate_by(xrotate, Vmrotation, amrotation) robot.push_command()
def disgust_gesture(robot): arm_vel_slow_m = robot.arm.params['motion']['slow']['vel_m'] arm_accel_slow_m = robot.arm.params['motion']['slow']['accel_m'] arm_vel_default_m = robot.arm.params['motion']['default']['vel_m'] arm_accel_default_m = robot.arm.params['motion']['default']['accel_m'] arm_vel_fast_m = robot.arm.params['motion']['fast']['vel_m'] arm_accel_fast_m = robot.arm.params['motion']['fast']['accel_m'] print("Doing gestures now...") # robot.startup() robot.head.move_to('head_pan', 2.14) robot.end_of_arm.move_to('wrist_yaw', 0) robot.base.rotate_by(x_r=1) robot.lift.move_to(x_m=1) robot.arm.move_to(x_m=0.3, v_m=arm_vel_fast_m) robot.push_command() time.sleep(3.5) robot.head.move_to('head_pan', -1) robot.base.rotate_by(x_r=-1) robot.lift.move_to(x_m=0.7) robot.arm.move_to(x_m=0) robot.push_command() time.sleep(6) # robot.stow() # robot.stop() return
def dance1(robot): robot.end_of_arm.move_by('wrist_yaw', -xwrist, Vrwrist, Arwrist) robot.push_command() time.sleep(t3) robot.lift.move_to(0.55, Vmlift, amlift) robot.end_of_arm.move_by('wrist_yaw', xwrist, Vrwrist, Arwrist) robot.push_command() time.sleep(t3)
def dance2(robot): while(True): robot.lift.move_to(0.50,Vmlift,amlift) robot.push_command() time.sleep(t2) robot.lift.move_to(-0.50,Vmlift,amlift) robot.push_command() time.sleep(t2)
def dance4(robot): while(True): robot.base.rotate_by(x_r=0.8) robot.push_command() time.sleep(t) robot.base.rotate_by(x_r=-1.0) robot.push_command() time.sleep(t)
def joy_gesture(robot): base_vel_fast_m = robot.base.params['motion']['fast']['vel_m'] base_accel_fast_m = robot.base.params['motion']['fast']['accel_m'] print("Doing gestures now...") robot.head.move_to('head_pan', -1) robot.head.move_to('head_tilt', 0) robot.base.translate_by(x_m=0.2, v_m=base_vel_fast_m) robot.lift.move_to(x_m=0.8) robot.arm.move_to(0.3) robot.push_command() time.sleep(3) robot.head.move_to('head_pan', 0) robot.head.move_to('head_tilt', 0.5) robot.arm.move_to(0.1) robot.lift.move_to(x_m=0.6) robot.push_command() time.sleep(3) # robot.stow() # robot.stop() return
def dance6(robot): robot.lift.move_to(0.50, Vmlift, amlift) robot.end_of_arm.move_by('wrist_yaw', -xwrist, Vrwrist, Arwrist) robot.push_command()
def dance24(robot): robot.head.move_to('head_pan', -xpan, Vrpan, Arpan) robot.arm.move_to(0.30, Vmarm, amarm) robot.lift.move_to(0.7, Vmlift, amlift) robot.base.rotate_by(xrotate, Vmrotation, amrotation) robot.push_command()
def dance20(robot): robot.head.move_to('head_pan', xpan, Vrpan, Arpan) robot.end_of_arm.move_by('wrist_yaw', xwrist, Vrwrist, Arwrist) robot.push_command()
def dance14(robot): robot.arm.move_to(0.3, Vmarm, amarm) robot.head.move_to('head_tilt', xtilt, Vrtilt, Artilt) robot.head.move_to('head_pan', xpan, Vrpan, Arpan) robot.end_of_arm.move_by('wrist_yaw', xwrist, Vrwrist, Arwrist) robot.push_command()
def dance13(robot): robot.arm.move_to(0.28, Vmarm, amarm) robot.head.move_to('head_pan', -xpan, Vrpan, Arpan) robot.end_of_arm.move_by('wrist_yaw', -xwrist, Vrwrist, Arwrist) robot.push_command()
def dance12(robot): robot.lift.move_to(0.6, Vmlift, amlift) robot.arm.move_to(0.3, Vmarm, amarm) robot.head.move_to('head_pan', xpan, Vrpan, Arpan) robot.end_of_arm.move_by('wrist_yaw', xwrist, Vrwrist, Arwrist) robot.push_command()
def dance10(robot): robot.head.move_to('head_tilt', 0, Vrtilt, Artilt) robot.lift.move_to(0.55, Vmlift, amlift) robot.end_of_arm.move_by('wrist_yaw', xwrist, Vrwrist, Arwrist) robot.push_command()
sound = AudioSegment.from_file(filename) sound.apply_gain(100) play(sound) return if __name__ == "__main__": robot = stretch_body.robot.Robot() robot.startup() # robot.stow() robot.head.move_to('head_tilt', -1) robot.lift.move_to(0.50, 10, 10) robot.end_of_arm.move_to('wrist_yaw', 1) robot.push_command() time.sleep(3) p1 = Thread(target=audio) p1.daemon = True p1.start() p2 = Thread(target=dance1, args=(robot, )) p2.daemon = True p2.start() time.sleep(t3) p3 = Thread(target=dance2, args=(robot, )) p3.daemon = True p3.start() time.sleep(t3) p4 = Thread(target=dance3, args=(robot, )) p4.daemon = True