Exemple #1
0
 def docking_reset(self):
     """
     Reset the head to a neutral position.
     """
     tk = Track()
     tk.add(0.0, self.head_mot.reset())
     return tk
Exemple #2
0
 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
Exemple #3
0
 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
Exemple #4
0
 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
Exemple #5
0
 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
Exemple #6
0
 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 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
Exemple #8
0
 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
Exemple #9
0
 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
Exemple #10
0
 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
Exemple #11
0
 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
Exemple #12
0
 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
Exemple #13
0
 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
Exemple #14
0
 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
Exemple #15
0
 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
Exemple #16
0
 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 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 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
Exemple #19
0
 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
Exemple #20
0
 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
Exemple #21
0
 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
Exemple #22
0
 def stop(self, reset_head=False):
     """
     Stop the robot's base from moving (optionally reset the head too!).
     """
     tk = Track()
     tk.add(0.0, self.wheels_mot.stop())
     if reset_head:
         tk.add(0.0, self.head_mot.neutral())
         tk.add(0.0, self.head_mot.openeyes())
     return tk
 def greeting_first_capture(self):
     """
     A short smile and Kuri's iconic greeting sound.
     Length: 2 seconds
     """
     tk = Track()
     tk.add(0.0, self.head_mot.happyeyes())
     tk.add(0.0, self.sound_mot.open('Greeting.wav'))
     tk.add(2.0, self.head_mot.openeyes())
     return tk
Exemple #24
0
 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
Exemple #25
0
 def play_live_animation(self, command):
     animationCommand = command
     animation = AnimationParser.parse_animation(animationCommand.json)
     if animation is not None and not animation.hasParseErrors:
         track = Track()
         self.animation_assembler.add_animation_to_track(animation, track)
         self._play_track(track)
         return self.currentTrackPlayer
     logger.error('Could not play animation because of parse error.')
     return
Exemple #26
0
 def docking_preparing_to_rotate_180(self, cw=True, mood=0.0):
     """
     Plays after Kuri has approached the dock (can see the close-field
     LED), before rotating to align the bot's charging contacts.
     """
     tk = Track()
     speed = (mood + 10) * 0.1
     side = 1 if cw else -1
     tk.add(0.1 * speed, self.head_mot.moveeyes(Head.EYES_CLOSED, 0.15))
     tk.add(
         0.1 * speed,
         self.head_mot.pantilt(pan=-0.8 * side,
                               tilt=Head.TILT_NEUTRAL,
                               duration=0.3 * speed))
     tk.add(0.3 * speed, self.head_mot.moveeyes(Head.EYES_OPEN, 0.35))
     tk.add(
         0.5 * speed,
         self.head_mot.pantilt(pan=-0.8 * side,
                               tilt=Head.TILT_NEUTRAL,
                               duration=0.1 * speed))
     return tk
Exemple #27
0
 def triple_blink(self):
     tk = Track()
     blink_time_1 = max(
         self.PAUSE_MIN,
         min(self.PAUSE_MAX,
             normalvariate(self.PAUSE_MEAN, self.PAUSE_STD_DEV)))
     blink_time_2 = max(
         self.PAUSE_MIN,
         min(self.PAUSE_MAX,
             normalvariate(self.PAUSE_MEAN, self.PAUSE_STD_DEV)))
     tk.add(0.0, self.head_mot.blink())
     tk.add(blink_time_1, self.head_mot.blink())
     tk.add(blink_time_1 + blink_time_2, self.head_mot.blink())
     return tk
 def relocalize_part6(self):
     keep_alive_speed = 0
     spacing = (keep_alive_speed * 0.6 + 10) * 0.1
     tk = Track()
     tk.add(
         0.6 * spacing,
         self.head_mot.blinkeyes(open_amplitude=1.0,
                                 close_amplitude=1.0,
                                 open_time=0.27,
                                 close_time=0.15))
     tk.add(0.7 * spacing, self.wheels_mot.rotate(-10, 1.5))
     tk.add(0.7 * spacing, self.head_mot.pantilt(pan=0,
                                                 tilt=0,
                                                 duration=1.5))
     return tk
Exemple #29
0
 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
Exemple #30
0
 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