示例#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
示例#2
0
文件: states.py 项目: garywang/tart
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
示例#3
0
文件: states.py 项目: garywang/tart
 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
示例#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