示例#1
0
    def use_brain(self) -> SimpleControllerState:
        # Check kickoff
        if self.info.is_kickoff and not self.doing_kickoff:
            self.maneuver = choose_kickoff_maneuver(self)
            self.doing_kickoff = True
            self.print("Kickoff - Hello world!")

        # Execute logic
        if self.maneuver is None or self.maneuver.done:
            # There is no maneuver, use utility system to find a choice
            self.maneuver = None
            self.doing_kickoff = False
            self.choice = self.ut.evaluate(self)
            ctrl = self.choice.exec(self)
            # The choice has started a maneuver, reset utility system and execute maneuver instead
            if self.maneuver is not None:
                self.ut.reset()
                self.choice = None
                return self.maneuver.exec(self)
            return ctrl

        return self.maneuver.exec(self)
    def use_brain(self) -> SimpleControllerState:
        # Check kickoff
        if self.info.is_kickoff and not self.doing_kickoff:
            self.maneuver = choose_kickoff_maneuver(self)
            self.doing_kickoff = True
            self.print("Kickoff - Hello world!")

        # Execute logic
        if self.maneuver is None or self.maneuver.done:
            # There is no maneuver (anymore)
            self.maneuver = None
            self.doing_kickoff = False

            self.choice = self.ut.get_best_state(self)
            ctrl = self.choice.run(self)

            # The state has started a maneuver. Execute maneuver instead
            if self.maneuver is not None:
                return self.maneuver.exec(self)

            return ctrl

        return self.maneuver.exec(self)