예제 #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)
예제 #2
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)
    def setup(self):
        stand = self.Stand()
        walk = self.Walk()
	walk_turn = self.Walk_Turn()
        sit = pose.Sit()
        off = self.Off()
        self.trans(stand, C, walk, T(5.0), walk_turn, T(5.0), sit, C, off)
예제 #4
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):
     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)
예제 #6
0
  def setup(self):
    ball = memory.world_objects.getObjPtr(core.WO_BALL)
    goal = memory.world_objects.getObjPtr(core.WO_UNKNOWN_GOAL)

    rdy = GetReady()
    moveHeadLeft = MoveHeadLeft(-15.0)
    moveHeadRight = MoveHeadRight(-45.0)
    turnInPlace = TurnInPlace()
    goToBall = GoToBall(ball, 0.0)

    moveHeadLeftGoal = MoveHeadLeft(0.0)
    moveHeadRightGoal = MoveHeadRight(0.0)
    turnAroundBall = TurnAroundBall(ball,200.0)
    lookDown = LookDown()
    align200 = Align(ball,goal,200.0, -15.0)  

    dribble = Align(ball,goal,-200.0, -20.0)
    wait = Stand()
    align50 = Align(ball,goal,50.0,-15.0)

    alignForKick = Align(ball,goal, 0.0, -30.0)
    positionForKick = PositionForKick(ball, 0.28, 140.0)

    stand = Stand()
    stand_again = Stand()
    kick = Kick()

    # Keep turning head and turning in place till ball is found and then go to ball
    self.add_transition(rdy,C,moveHeadLeft,C,moveHeadRight,C,turnInPlace,C,moveHeadLeft)
    self.add_transition(moveHeadLeft,B(ball),goToBall)
    self.add_transition(moveHeadRight,B(ball),goToBall)
    self.add_transition(turnInPlace,B(ball),goToBall)
    self.add_transition(goToBall,NB(ball),moveHeadLeft)

    # After Robot reaches near the ball, maintain distance to ball and find the goal
    self.add_transition(goToBall,BD(ball,200.0),moveHeadLeftGoal,C,moveHeadRightGoal,C,lookDown,C,turnAroundBall,C,moveHeadLeftGoal)
    self.add_transition(moveHeadLeftGoal,GB(goal,ball),align200)
    self.add_transition(moveHeadRightGoal,GB(goal,ball),align200)
    self.add_transition(lookDown,GB(goal,ball),align200)
    self.add_transition(turnAroundBall,GB(goal,ball),align200)
    self.add_transition(align200,NGB(goal,ball),turnAroundBall)
    self.add_transition(turnAroundBall,NB(ball),rdy)

    # If the ball and goal are aligned with the robot, proceed to stopping, judging distance and dribbling/shooting
    self.add_transition(align200,A(ball,goal),dribble)
    self.add_transition(dribble,A(ball,goal,0.2).negation(),align50)
    self.add_transition(align50,A(ball,goal),dribble)
    self.add_transition(dribble,D(ball,goal,1300.0).negation(),wait)
    self.add_transition(wait,D(ball,goal,1300.0),dribble)

    # After it's dribbled, align between ball and goal again and then shift left
    self.add_transition(wait,T(1.0),alignForKick)
    self.add_transition(alignForKick, BD(ball,150.0), positionForKick)
    self.add_transition(positionForKick, BB(ball,0.28), stand)
    self.add_transition(stand, T(1.0), kick)
    self.add_transition(kick, C, stand_again)
    self.add_transition(stand_again, T(3.0), rdy)
예제 #7
0
    def setup(self):
        stand = self.Stand()
        sit = pose.Sit()
        headturn = self.HeadTurn()
        headturnback = self.HeadTurnBack()

        forwardwalk = self.ForwardWalk()
        turninplace = self.TurnInPlace()
        curvewalk = self.CurveWalk()

        off = self.Off()
        self.trans(stand, C, headturn, T(3.0), headturnback,
                   T(3.0), forwardwalk, T(5.0), turninplace, T(5.0), curvewalk,
                   T(5.0), sit, C, off)
 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)
 def setup(self):
     stand = self.Stand()
     walk = self.Walk()
     turn = self.Turn()
     sit = pose.Sit()
     seen = self.Seen()
     panleft = self.HeadPanL()
     panright = self.HeadPanR()
     panstraight = self.HeadPanZ()
     tiltup = self.TiltHeadUp()
     tiltdown = self.TiltHeadDown()
     fwdturn = self.ForwardTurn()
     off = self.Off()
     self.trans(stand, C, panleft, T(2.0), panright, T(2.0), panstraight,
                T(2.0), tiltup, T(2.0), tiltdown, T(2.0), sit, C, off)
예제 #10
0
 def setup(self):
     stand = self.Stand()
     walk = self.Walk()
     sit = pose.Sit()
     off = self.Off()
     raise_right = pose.RaiseRightArm()
     self.trans(sit, C, raise_right, T(5.0), sit, C, off)
예제 #11
0
 def setup(self):
     stand = self.Stand()
     sit = pose.Sit()
     Goalseen = self.GoalSeen()
     Ballseen = self.BallSeen()
     off = self.Off()
     self.trans(stand, C, Ballseen, T(20.0), sit, C, off)
예제 #12
0
    def setup(self):
        global vx
        global vy
        global vtheta
        global goal_side
        global ball_side
        global dribble
        global left_offset
        global play_mode
        global FACTOR

        vx = 0.
        vy = 0.
        vtheta = 0.

        goal_side = 1
        ball_side = 1
        play_mode = 1
        dribble = 0.

        left_offset = 0.

        findball = FindBall()
        followball = FollowBall()
        stand = Stand()
        self.add_transition(stand, C, findball)
        self.add_transition(findball, C, followball, T(DELAY), findball)
예제 #13
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)
예제 #14
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):
     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)
예제 #16
0
    def setup(self):
        stand = self.Stand()
        sit = pose.Sit()
        diag = self.Diagnostic()
        locdiag = self.localization_diag()
        panleft = self.HeadLeft()
        #self.trans(stand,C)

        #print("a")
        self.trans(stand, C, locdiag, T(120.0), sit)
 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)
예제 #18
0
 def setup(self):
     stand = self.Stand()
     walk = self.Walk()
     turn = self.Turn()
     sit = pose.Sit()
     seen = self.Seen()
     panleft = self.HeadPanL()
     panright = self.HeadPanR()
     panstraight = self.HeadPanZ()
     fwdturn = self.ForwardTurn()
     off = self.Off()
     self.trans(stand, C, fwdturn, T(20.0), sit, C, off)
예제 #19
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)
예제 #20
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)
예제 #21
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)
예제 #22
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)
예제 #23
0
    def setup(self):
        sit = pose.Sit()
        head_left = self.TurnHead()
        body_left_in_place = self.TurnBodyLeftInPlace()
        body_right_in_place = self.TurnBodyRightInPlace()
        body_left_walking = self.TurnBodyLeftWalking()
        walk = self.Walk()
        stand = self.Stand()
        off = self.Off()

#         self.trans(stand, C, walk, T(2.0), head_left, C, sit, C, off) # walk, turn head left
#         self.trans(stand, C, body_left_walking, T(4.0), sit, C, off) # walk in a curve
#         self.trans(stand, C, walk, T(2.0), body_left_in_place, T(2.0), sit, C, off) # walk forward and then turn in place

        # all the motions (walk forward, turn left in place, walk and turn left simultaneously, sit, turn head left
        self.trans(stand, C,
                   walk, T(2.0),
                   body_left_in_place, T(2.0),
                   body_left_walking, T(6.0),
                   body_right_in_place, T(5.5),
                   sit, C,
                   head_left, C,
                   off)
예제 #24
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)
예제 #25
0
    def setup(self):
        stand = self.Stand()
        sit = pose.Sit()
        Goalseen = self.GoalSeen()
        Ballseen = self.BallSeen()
        off = self.Off()
        turn = self.Turn()
        ball = memory.world_objects.getObjPtr(core.WO_BALL)
        print(ball.seen)
        #self.trans(stand,C)

            #print("a")

        self.trans(turn)
        print("sad")
        self.trans(Ballseen, T(20.0), sit, C, off)
예제 #26
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)
예제 #27
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)
예제 #28
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)
예제 #29
0
    def setup(self):
        stand = self.Stand()
        walk = self.Walk()
        turnL = self.TurnL()
        turnR = self.TurnR()

        sit = pose.Sit()
        fwdturn = self.ForwardTurn()
        targ = self.WalkTarget()
        ped = self.WalkP()
        panL = self.HeadPanL()
        panR = self.HeadPanR()
        panZ = self.HeadPanZ()

        off = self.Off()
        tilt = self.HeadTilt()
        # self.trans(stand, C, tilt, T(5.0),turnL,T(10.0),turnR,T(10.0) ,sit, C, off)

        self.trans(stand, C, walk, T(5.0), sit, C, off)
예제 #30
0
 def setup(self):
     gazer = Gazer()
     gaze = Gaze()
     on = On()
     self.add_transition(on, C, gazer)
     self.add_transition(gazer, C, gaze, T(DELAY), gazer)