Ejemplo n.º 1
0
 def setup(self):
     off = Offense()
     diag = Diagnostic()
     action_blocks = {
         "forward": stepForward(),
         "back": stepBack(),
         "turnleft": turnLeft(),
         "turnright": turnRight(),
         "left": stepLeft(),
         "right": stepRight(),
         "forwardleft": stepForwardLeft(),
         "forwardright": stepForwardRight(),
         "none": NoneClass(),
         "stop": stopStill(),
         "kick": Kick(),
         "wheelleft": wheelLeft(),
         "wheelright": wheelRight()
     }
     kicklist = ["kick"]
     time_step = 2.0
     for name in action_blocks:
         b = action_blocks[name]
         print("Block module: ", b)
         if name in kicklist:
             self.add_transition(off, S(name), b, T(10.5), off)
         else:
             self.add_transition(off, S(name), b, T(time_step), off)
 def setup(self):
     off = Offense()
     diag = Diagnostic()
     blocks = {
         "approach": Approach(),
         "ballsearch": BallSearch(),
         "circle_anti": CircleWalkAnti(),
         "circle": CircleWalk(),
         "dribbler": DribbleRight(),
         "dribblel": DribbleLeft(),
         "none": NoneClass(),
         "sit": reinit(),
         "walkball": Walk2Ball(),
         "kick": Kick()
     }
     kicklist = ["kick"]
     drib = ["dribbler", "dribblel"]
     # sit = reinit()
     # self.trans(self.Stand(),C)
     for name in blocks:
         b = blocks[name]
         print("Block module: ", b)
         if name in kicklist:
             self.add_transition(off, S(name), b, T(10.5), off)
         elif name in drib:
             print(name)
             self.add_transition(off, S(name), b, T(15.0), off)
         else:
             self.add_transition(off, S(name), b, T(0.5), off)
Ejemplo n.º 3
0
    def setup(self):
        raiseArm = RaiseArms()
        sit = pose.SittingPose()
        wait = Wait
        arms = {
            "left": pose.RaiseLeftArm(time=1.),
            "right": pose.RaiseRightArm(time=1.),
            "center": pose.RaiseBothArms(time=1.),
            "unseen": NotSeen(),
            "nomove": pose.SittingPose(time=0.3),
        }

        # arms = {"left": RaiseLeft(),
        # "right": RaiseRight(),
        # "center": RaiseBoth(),
        # "not_seen": NotSeen()
        # }
        # self.add_transition(sit, T(0.5), pose.RaiseRightArm(), T(5), sit)
        # self.trans(raiseArm, S("nomove"), sit, T(0.3), pose.RaiseBothArms(), T(5), raiseArm)

        for direction in arms:
            arm = arms[direction]
            if direction in ["left", "right", "center"]:
                self.add_transition(raiseArm, S(direction), arm, T(0.1),
                                    raiseArm)
            else:
                self.add_transition(raiseArm, S(direction), arm, T(0.1),
                                    raiseArm)
 def setup(self):
     defense = Defense()
     blocks = {"kick":Kick()
               }
     savelist = ["left","right","center"]
     # sit = reinit()
     # self.trans(self.Stand(),C)
     for name in blocks:
         b = blocks[name]
         print("Block module: ",b)
         if name in savelist:
           self.add_transition(defense, S(name), b, T(2.5), defense)            
         else:
           self.add_transition(defense, S(name), b, T(10.5), defense)
Ejemplo n.º 5
0
    def setup(self):
        off = Offense()
        diag = Diagnostic()
        blocks = {"approach": Approach(),
                  "ballsearch":BallSearch(),
                  "circle_anti":CircleWalkAnti(),
                  "circle":CircleWalk(),
                  "dribble":Dribble(),
                  "none": NoneClass(),
                  "sit": reinit(),
                  "walkball": Walk2Ball(),
                  "kick":Kick()
                  }
        kicklist = ["kick"]
        # sit = reinit()
        # self.trans(self.Stand(),C)
        for name in blocks:
            b = blocks[name]
            print("Block module: ",b)
            if name in kicklist:
                self.add_transition(off, S(name), b, T(10.5), off)
            else:
                self.add_transition(off, S(name), b, T(0.5), off)

        #             stand = self.Stand()
        # sit = pose.Sit()
        # # Goalseen = self.GoalSeen()
        # # Ballseen = self.BallSeen()
        # off = self.Off()
        # srch = self.BallSearch()
        # trn = self.Turn2Ball()
        # wlk = self.Walk2Ball()
        # ball = memory.world_objects.getObjPtr(core.WO_BALL)
        # crc = self.CircleWalk()
        # diag = self.Diagnostic()
        # app  = self.Approach()
        # drb  = self.Dribble()
        # #self.trans(stand,C)

        #     #print("a")
        # # self.trans(stand,C,diag,T(120.0),sit,C,off)

        # # self.trans(stand,C,crc,C,app,C,sit,C,off)
        # #self.trans(stand,C,app,C,self.Stable(),C,self.Kick(),C,sit,C,off)
        # # self.trans(stand,C,srch,C,trn,C, wlk,C,crc,C,app,C,self.Kick(),C,sit,C,off)
        # self.trans(stand,C,srch,C,trn,C, wlk,C,crc,C,drb,C,self.Stable(),C,app,C,self.Stable(),C,self.Kick(),C,sit,C,off)
Ejemplo n.º 6
0
    def setup(self):
        blocker = Blocker()
        penalty = ApproachBall()

        blocks = {
            "left": pose.BlockLeft(),
            "right": pose.BlockRight(),
            #"center": pose.SitBlock(),
            "center": pose.BlockCenter(),
        }

        for name in blocks:
            b = blocks[name]
            self.add_transition(blocker, S(name), b, T(4.25), blocker)

        self.add_transition(blocker, S("penalty"), penalty)
        self.add_transition(penalty, S("blocker"), blocker)
Ejemplo n.º 7
0
    def setup(self):
        robot = memory.world_objects.getObjPtr(core.WO_TEAM5)
        rdy = GetReady()
        stand = Stand()
        faced = False
        #####TODO: remember to change these times back!!
        moveHeadLeft = MoveHead(110.0, 0.0, .1)
        moveHeadRight = MoveHead(-110.0, 0.0, .2)

        follow = FollowPath(robot)
        restJoints = RestJoints()

        faceNextCell = FaceNextCell(robot, faced)

        self.add_transition(rdy, C, moveHeadLeft, C, moveHeadRight, C, follow,
                            S("head"), faceNextCell, C, moveHeadLeft)
        self.add_transition(follow, S("hot"), restJoints, S("cool"),
                            moveHeadLeft)
 def setup(self):
     stand = self.Stand()
     turn_head = self.Turn_Head()
     walk = self.Walk()
     walk_turn = self.Walk_Turn();
     turn_in_place = self.Turn_In_Place();
     sit = pose.Sit()
     off = self.Off()
     self.trans(stand, C, turn_head, S("done"), sit, C, walk, T(5.0), turn_in_place, T(3.0), walk_turn, T(5.0), off)
Ejemplo n.º 9
0
 def setup(self):
     blocker = Blocker()
     blocks = {"left": BlockLeft(),
               "right": BlockRight(),
               "center": BlockCenter()
               }
     for name in blocks:
         b = blocks[name]
         self.add_transition(blocker, S(name), b, T(5), blocker)
 def setup(self):
     defense = Defense()
     blocks = {"LineUp":ApproachToLine(),
               "stop":StopStill(),
               "rotate": Rotate(),
               "ball search": BallSearch(),
               "left":BlockLeft(),
               "right":BlockRight(),
               "center":BlockCenter()
               }
     savelist = ["left","right","center"]
     # sit = reinit()
     # self.trans(self.Stand(),C)
     for name in blocks:
         b = blocks[name]
         print("Block module: ",b)
         if name in savelist:
           self.add_transition(defense, S(name), b, T(1.7), defense)            
         else:
           self.add_transition(defense, S(name), b, T(0.5), defense)
Ejemplo n.º 11
0
    def setup(self):
        turner = Turner()
        localizer = Localizer()
        walker = Walker()
        beacon_walker = BeaconWalker()
        sitter = pose.Sit()
        walkTowardsBeacon = WalkTowardsBeacon()

        nodes = {
            'turn': turner,
            'move': walker,
            'sit': sitter,
            'walk_towards_beacon': walkTowardsBeacon,
        }

        for signal, node in nodes.iteritems():
            if signal == 'sit':
                self.add_transition(localizer, S(signal), node, T(10),
                                    localizer)
            elif signal == 'walk_towards_beacon':
                self.add_transition(localizer, S(signal), node, C, localizer)
            else:
                self.add_transition(localizer, S(signal), node, T(0.1),
                                    localizer)

        self.add_transition(walkTowardsBeacon, S('no_towards_beacon'),
                            localizer)
        self.add_transition(walkTowardsBeacon, S('stop_towards_beacon'),
                            localizer)
        self.add_transition(walkTowardsBeacon, S('keep_towards_beacon'),
                            beacon_walker, T(0.1), walkTowardsBeacon)
Ejemplo n.º 12
0
    def setup(self):
        gazer = Gazer()
        stand = Stand()
        actions = {
            'left': TurnLeft(),
            'right': TurnRight(),
            'front': WalkFront(),
            'stop': Stop(),
        }

        self.add_transition(stand, C, gazer)
        for name, action in actions.items():
            self.add_transition(gazer, S(name), action, T(0.2), gazer)
Ejemplo n.º 13
0
 def setup(self):
     blocker = Blocker()
     blocks = {"left": BlockLeft(),
               "right": BlockRight(),
               "center": BlockCenter(),
               "sit": reinit()
               }
     # sit = reinit()
     # self.trans(self.Stand(),C)
     for name in blocks:
         b = blocks[name]
         print("Block module: ",b)
         self.add_transition(blocker, S(name), b, T(2), blocker)
Ejemplo n.º 14
0
    def setup(self):
        blocker = Blocker()
        blocks = {
            "left": pose.BlockLeft(),
            "right": pose.BlockRight(),
            "center": pose.Squat()  # Does not get up after squatting
        }
        for name in blocks:
            b = blocks[name]
            stand = pose.Stand()

            # Time less than 6 turns off robot after squatting
            #self.add_transition(blocker, S(name), b, T(3.25), blocker)
            self.add_transition(blocker, S(name), b, T(6.0), blocker)
Ejemplo n.º 15
0
    def setup(self):
        ball = mem_objects.world_objects[core.WO_BALL]
        robot = world_objects.getObjPtr(core.WO_TEAM5)

        localized = False
        poseListX = []
        poseListY = []
        poseListTh = []
        pose_index = 0
        blocker = Blocker()
        lookStraight = MoveHead(0.0, -10.0, 2.5)
        moveHeadLeft = MoveHead(85.0, -10.0, 2.5)
        moveHeadRight = MoveHead(-85.0, -10.0, 5.0)
        reset = Reset()
        rdy = GetReady()
        moveBtwBall = MoveBtwBall(localized, poseListX, poseListY, poseListTh,
                                  pose_index)
        checkLoc = CheckIfLocalized(localized, poseListX, poseListY,
                                    poseListTh, pose_index)
        blocks = {
            "left": BlockLeft(),
            "right": BlockRight(),
            "center": BlockCenter(),
            "miss": DontBlock()
        }
        locState = {"lost": moveHeadLeft, "localized": blocker}
        self.add_transition(rdy, C, checkLoc)
        for state in locState:
            s = locState[state]
            self.add_transition(checkLoc, S(state), s)
            self.add_transition(moveBtwBall, S(state), s)
        for name in blocks:
            b = blocks[name]
            self.add_transition(blocker, S(name), b, T(4.0), reset, T(3.0),
                                blocker)
        self.add_transition(blocker, S("moveBall"), moveBtwBall)
        self.add_transition(moveHeadLeft, C, moveHeadRight, C, checkLoc)
Ejemplo n.º 16
0
 def setup(self):
     finder = Finder()
     diag = Diagnostic()
     blocks = {"lookleft": HeadLeft(),
               "lookright": HeadRight(),
               "holdlook": HeadStill(),
               "movecenter": MoveCenter(),
               "movepoint": MoveToPoint(),
               "reachedcenter":ReachCenter(),
               "turn":TurnInPlace(),
               "sit": reinit()
               }
     # sit = reinit()
     # self.trans(self.Stand(),C)
     for name in blocks:
         b = blocks[name]
         print("Block module: ",b)
         self.add_transition(finder, S(name), b, T(0.5), finder)
Ejemplo n.º 17
0
    def setup(self):
        raiseArm = RaiseArms()
        arms = {
            "left": pose.RaiseLeftArm(),
            "right": pose.RaiseRightArm(),
            "center": pose.RaiseBothArms(),
            "not_seen": pose.SittingPose()
        }

        # arms = {"left": RaiseLeft(),
        # "right": RaiseRight(),
        # "center": RaiseBoth(),
        # "not_seen": NotSeen()
        # }

        for direction in arms:
            arm = arms[direction]
            self.add_transition(raiseArm, S(direction), arm, T(1), raiseArm)
Ejemplo n.º 18
0
    def setup(self):
        ball = mem_objects.world_objects[core.WO_BALL]

        blocker = Blocker()
        lookStraight = MoveHead(0.0, -10.0, 2.5)
        moveHeadLeft = MoveHead(85.0, -10.0, 2.5)
        moveHeadRight = MoveHead(-85.0, -10.0, 5.0)
        reset = Reset()
        rdy = GetReady()
        blocks = {
            "left": BlockLeft(),
            "right": BlockRight(),
            "center": BlockCenter(),
            "miss": DontBlock()
        }

        reset = DontBlock()
        for name in blocks:
            b = blocks[name]
            self.add_transition(blocker, S(name), b, T(2), reset, T(3.0),
                                blocker)
Ejemplo n.º 19
0
 def setup(self):
     switch = self.Switch()
     touched = self.Touched()
     self.trans(touched, S('switch_phase'), switch, C, touched)
     self.trans(touched, S('remain'), touched)