Beispiel #1
0
    def __execute(self):
        audience = self.audience

        # Pick a person to gaze at initially
        if isinstance(audience, Entity):
            person = audience

            with self.lock:
                if not self.preempt_requested:
                    self.gaze_ah = self.robot.gaze(person.head)
        else:
            if isinstance(audience, list):
                audience = Query(audience)

            results = audience.sort_increasing(lambda p: p.distance_to(self.robot)).execute()

            if len(results) > 0:
                person = results[0]
                self.current_gazee = person

                with self.lock:
                    if not self.preempt_requested:
                        self.gaze_ah = self.robot.gaze(person.head)

        if self.gaze_ah is not None:
            self.robot.wait(self.gaze_ah)

        with self.lock:
            if not self.preempt_requested:
                self.say_ah = self.robot.say(self.sentence)
Beispiel #2
0
    def __execute(self):
        audience = self.audience

        # Pick a person to gaze at initially
        if isinstance(audience, Entity):
            person = audience

            with self.lock:
                if not self.preempt_requested:
                    self.gaze_ah = self.robot.gaze(person.head)
        else:
            if isinstance(audience, list):
                audience = Query(audience)

            results = audience.sort_increasing(lambda p: p.distance_to(self.robot)).execute()

            if len(results) > 0:
                person = results[0]
                self.current_gazee = person

                with self.lock:
                    if not self.preempt_requested:
                        self.gaze_ah = self.robot.gaze(person.head)

        if self.gaze_ah is not None:
            self.robot.wait(self.gaze_ah)

        with self.lock:
            if not self.preempt_requested:
                self.say_ah = self.robot.say(self.sentence)