def tilt(self, x): """ @param x: radians from the neutral position (positive looking down) """ tk = Track() tk.add(0.0, self.head_mot.pantilt(self.head.cur_pan, x, 0.5)) return tk
def pan(self, x): """ @param x: radians from the neutral position (positive to the right) """ tk = Track() tk.add(0.0, self.head_mot.lookat(x, 0.5)) return tk
def putdown(self): """ Animation that runs when the robot is put down. """ tk = Track() tk.add(0, self.sound_mot.open('Putdown.wav')) return tk
def breath(self, excited, happy): tk = Track() one_breath = self.lights_mot.heartbeat(happiness_to_color(happy), happiness_to_fade(happy), excitation_to_period(excited)) tk.add(0.0, one_breath) return tk
def docking_reset(self): """ Reset the head to a neutral position. """ tk = Track() tk.add(0.0, self.head_mot.reset()) return tk
def eyes(self, x, spd=0.5): """ @param x: radians from the neutral position (positive closing eyes, negative happy face) """ tk = Track() tk.add(0.0, self.head_mot.moveeyes(x, spd)) return tk
def pantilt(self, x, y, length=0.5): """ @param x: radians from the neutral position for pan @param y: radians from the neutral position for tilt """ tk = Track() tk.add(0.0, self.head_mot.pantilt(x, y, length)) return tk
def relocalize_part7(self): keep_alive_speed = 0 spacing = (keep_alive_speed * 0.6 + 10) * 0.1 speed = (keep_alive_speed + 10) * 0.1 tk = Track() tk.add(1.9 * spacing, self.head_mot.pantilt(pan=0.78, tilt=0, duration=0.25 * speed)) return tk
def undock(self): """ This is designed to get the robot off the dock before it starts to navigate """ tk = Track() tk.add(0.5, self.wheels_mot.inch(0.5, 0.5)) return tk
def live_undock(self): """ This is designed to get the robot off the dock before it starts to navigate, in live mode (so it should never be made 'cute') """ tk = Track() tk.add(0.5, self.wheels_mot.inch(0.5, 0.5)) return tk
def waypoint_reached(self, head_pose=None): """ Runs when a commanded waypoint is reached. """ tk = Track() if head_pose: tk.add(0, self.head_mot.pantilt(head_pose.pan, head_pose.tilt, 0.5)) return tk
def pickup(self): """ Animation that runs when the robot is picked up. """ tk = Track() tk.add(0.0, self.head_mot.reset()) tk.add(0, self.sound_mot.open('Pickup.wav')) return tk
def double_blink(self): blink_time = max( self.PAUSE_MIN, min(self.PAUSE_MAX, normalvariate(self.PAUSE_MEAN, self.PAUSE_STD_DEV))) tk = Track() tk.add(0.0, self.head_mot.blink()) tk.add(blink_time, self.head_mot.blink()) return tk
def old_giggle(self): tk = Track() tk.add(0.0, self.head_mot.happyposture()) tk.add(0.4, self.sound_mot.open('Giggle.wav')) tk.add(0.4, self.wheels_mot.rotate(-4.0, 0.2)) tk.add(0.7, self.wheels_mot.rotate(4.0, 0.2)) tk.add(1.0, self.head_mot.neutral()) tk.add(1.0, self.head_mot.openeyes()) return tk
def sheep(self): tk = Track() tk.add(0.0, self.head_mot.happyposture()) head_wiggle = self.head_mot.headwiggle(self.head.cur_pan, Head.TILT_NEUTRAL - 0.18) tk.add(0.3, head_wiggle) baa = self.sound_mot.open('sheep.wav') tk.add(0.0, baa) tk.add(baa.length(), baa) tk.add(3.0, self.head_mot.reset()) return tk
def seizure(self): """ Actuate joints through range of motions """ tk = Track() tk.add(0.0, self.head_mot.pantilt(0.8, 0.6, 0.5)) tk.add(0.01, self.head_mot.moveeyes(0.0, 0.5)) tk.add(0.5, self.head_mot.pantilt(-0.8, -0.6, 0.5)) tk.add(0.51, self.head_mot.moveeyes(0.4, 0.5)) tk.add(3.0, self.lights_mot.white_glow(255, 0.1, float('inf'))) return tk
def redock(self): """ This is designed to redock a robot that has inched off the dock when asleep. It needs to be a short motion so we don't grind the dock, especially if 'undocking' actually happened due to a power outage. The user should still be able to push Kuri off the dock. If it becomes not wheels-only make sure sleep coordinates it with twitches """ tk = Track() tk.add(0.5, self.wheels_mot.inch(-0.3, 0.2)) return tk
def at_attention_look_around(self, pan_face=Head.PAN_NEUTRAL, tilt_face=-0.5, move_base=True): tk = Track() tk.add(0.0, self.head_mot.openeyes()) if move_base: tk.add(0.0, self.wheels_mot.inch(0.08, 0.7)) tk.add(0.08, self.head_mot.happyeyes(0.17)) tk.add(0.25, self.head_mot.pantilt(pan_face, tilt_face, 0.25)) return tk
def test_pan(self): """ Move pan axis independently. """ tk = Track() tk.add(1.41, self.head_mot.neutral()) tk.add(3.1, self.head_mot.lookat(radians(90), 0.35)) tk.add(5.1, self.head_mot.lookat(radians(0), 0.35)) tk.add(7.1, self.head_mot.lookat(radians(90), 0.35)) return tk
def reset_sad(self): """ Animation that runs when the robot is reset """ tk = Track() tk.add(0.0, self.head_mot.sadposture()) tk.add(0.0, self.sound_mot.open('Sad3.wav')) tk.add(1.0, self.head_mot.closeeyes()) tk.add(1.0, self.head_mot.pantilt(self.head.PAN_NEUTRAL, self.head.TILT_DOWN, 0.5)) return tk
def test_tilt(self): """ Move tilt axis independently. """ tk = Track() tk.add(1.41, self.head_mot.neutral()) tk.add(3.1, self.head_mot.pantilt(0, radians(40), 0.35)) tk.add(5.1, self.head_mot.pantilt(0, radians(0), 0.35)) tk.add(7.1, self.head_mot.pantilt(0, radians(40), 0.35)) return tk
def observer_indicator(self): tk = Track() inner = (30, 0, 124) outer = (37, 0, 119) pattern = [outer] * Lights.NUM_LEDS pattern[Lights.IDX_INNER_BOTTOM_LEFT] = inner pattern[Lights.IDX_INNER_BOTTOM_RIGHT] = inner pattern[Lights.IDX_INNER_UPPER_LEFT] = inner pattern[Lights.IDX_INNER_UPPER_RIGHT] = inner pattern[Lights.IDX_CENTER] = Lights.OFF pattern[Lights.IDX_INNER_LEFT] = Lights.OFF pattern[Lights.IDX_INNER_RIGHT] = Lights.OFF tk.add( 0.0, self.lights_mot.glow_pattern(pattern, fade_length=0.0, hold_length=0.5)) return tk
def relocalize_part0(self): keep_alive_speed = 0 spacing = (keep_alive_speed * 0.6 + 10) * 0.1 speed = (keep_alive_speed + 10) * 0.1 tk = Track() tk.add(0, self.sound_mot.open('Wake.wav')) tk.add(0.0, self.head_mot.moveeyes(0, 0.08)) tk.add(0.0, self.head_mot.pantilt(pan=0, tilt=0.4, duration=0.2 * speed)) tk.add(0.7 * spacing, self.head_mot.pantilt(pan=0, tilt=0, duration=0.3 * speed)) return tk
def capture_start(self): tk = Track() tk.add(0.0, self.lights_mot.off(0.05)) tk.add(0.0, self.sound_mot.open('capture_start.wav')) tk.add( 0.05, self.lights_mot.pulse(color=(90, 90, 90), pulse_up_time=0.4, pulse_down_time=0.2)) tk.add( 1.05, self.lights_mot.pulse(color=(120, 120, 120), pulse_up_time=0.35, pulse_down_time=0.2)) tk.add( 2.05, self.lights_mot.pulse(color=(155, 155, 155), pulse_up_time=0.3, pulse_down_time=0.2)) return tk
def docking_complete_happy(self, speed=1.0): """ Plays after Kuri has successfully docked. This only plays the docking sound and a happy face """ tk = Track() random_side = random.choice([-1, 1]) tk.add(0.0, self.movies.to_animated('starburst-green.mov')) tk.add(0.0, self.sound_mot.open('docked.wav')) tk.add( 0.0, self.head_mot.pantilt(pan=-0.4 * random_side, tilt=Head.TILT_NEUTRAL, duration=0.45 * speed)) tk.add(0.1 * speed, self.head_mot.moveeyes(Head.EYES_HAPPY, 0.3)) tk.add( 1.1 * speed, self.head_mot.pantilt(pan=0.3 * random_side, tilt=-0.1, duration=0.3 * speed)) return tk
def night_light(self): tk = Track() tk.add(0.0, self.head_mot.neutral()) lullaby = self.sound_mot.open('Lullaby.wav') tk.add(0, lullaby) tk.add(0, self.lights_mot.night_light(lullaby.length(), period=10.0)) return tk
def reset_head(self, lights_fade_duration=None): tk = Track() tk.add(0.0, self.head_mot.reset()) if lights_fade_duration: tk.add(0, self.lights_mot.off(lights_fade_duration)) tk.add(0.4, self.head_mot.openeyes()) return tk
def wakeup_fast(self): tk = Track() tk.add(0.0, self.lights_mot.off(length=1.0)) tk.add(0.5, self.sound_mot.open('Wake.wav')) tk.add(0.5, self.head_mot.neutral()) tk.add(0.8, self.head_mot.openeyes()) return tk
def docking_rotate_180(self, cw=True, mood=0.0): """ Plays while Kuri is rotating 180 degrees, aligning the bot's charging contacts with the dock. """ tk = Track() speed = (mood + 10) * 0.1 side = 1 if cw else -1 tk.add(0.0, self.head_mot.moveeyes(Head.EYES_OPEN)) tk.add( 0.8 * speed, self.head_mot.pantilt(pan=0.2 * side, tilt=0.35, duration=0.4 * speed)) tk.add(2.3 * speed, self.head_mot.moveeyes(Head.EYES_CLOSED, 0.15)) tk.add( 2.4 * speed, self.head_mot.pantilt(pan=-0.6 * side, tilt=0.45, duration=0.3 * speed)) tk.add(2.6 * speed, self.head_mot.moveeyes(Head.EYES_OPEN, 0.25)) return tk
def test_eyes(self): """ Move eyelids independently. """ tk = Track() tk.add(3.1, self.head_mot.moveeyes(radians(30), 0.35)) tk.add(5.1, self.head_mot.moveeyes(radians(0), 0.35)) tk.add(7.1, self.head_mot.moveeyes(radians(30), 0.35)) return tk