Beispiel #1
0
 def __init__(self):
     State.__init__(self)
     #if random.uniform(0, 1)>0.5:
     if True:
         self.wall_follow = WallFollowController(robot.ard, self.drive)
     else:
         self.wall_follow = None
Beispiel #2
0
class ExploreState(State):
    """Go somewhere else so it can see some balls"""
    
    def __init__(self):
        State.__init__(self)
        #if random.uniform(0, 1)>0.5:
        if True:
            self.wall_follow=WallFollowController(robot.ard, self.drive)
        else:
            self.wall_follow=None
    
    def step(self):
        if self.map.get_visible_ball():
            return ApproachState()
        if time.time()-self.start_time>params.state_explore_timeout:
            return ScanState()
        if self.wall_follow is not None:
            self.wall_follow.follow_wall()
        else:
            wall=self.map.get_farthest_wall()
            if wall is not None:
                self.drive.drive_to_point(wall)
            else:
                self.drive.forward()
        return stuck_detect.detect() or self
Beispiel #3
0
 def __init__(self):
     State.__init__(self)
     #if random.uniform(0, 1)>0.5:
     if True:
         self.wall_follow=WallFollowController(robot.ard, self.drive)
     else:
         self.wall_follow=None
Beispiel #4
0
class ExploreState(State):
    """Go somewhere else so it can see some balls"""
    def __init__(self):
        State.__init__(self)
        #if random.uniform(0, 1)>0.5:
        if True:
            self.wall_follow = WallFollowController(robot.ard, self.drive)
        else:
            self.wall_follow = None

    def step(self):
        if self.map.get_visible_ball():
            return ApproachState()
        if time.time() - self.start_time > params.state_explore_timeout:
            return ScanState()
        if self.wall_follow is not None:
            self.wall_follow.follow_wall()
        else:
            wall = self.map.get_farthest_wall()
            if wall is not None:
                self.drive.drive_to_point(wall)
            else:
                self.drive.forward()
        return stuck_detect.detect() or self