示例#1
0
 def setUp(self):
     buoyData = {vision.Color.YELLOW: vision.BuoyEvent()}
     BuoyTrackingTest.setUp(self,
                            buoy.Recover,
                            buoy.Recover,
                            buoy.Searching,
                            buoyData=buoyData)
示例#2
0
    def testBuoyLost(self):
        """Make sure losing the light goes back to search"""
        # Put a fake event in the buoyData
        event = vision.BuoyEvent(-0.5, 0.5, vision.Color.YELLOW)
        self.ai.data['buoyData'][vision.Color.YELLOW] = event

        self.injectEvent(vision.EventType.BUOY_LOST, vision.BuoyEvent,
                         color = vision.Color.YELLOW)
        self.assertCurrentState(buoy.FindAttempt)
示例#3
0
    def testIncorrectBuoyLost(self):
        """
        Buoy data for incorrect buoys should be deleted, but the state
        should not be changed
        """
        event = vision.BuoyEvent(0.0, 0.0, vision.Color.RED)
        self.ai.data['buoyData'][vision.Color.RED] = event

        self.injectEvent(vision.EventType.BUOY_LOST, vision.BuoyEvent,
                         color = vision.Color.RED)
        #self.assert_(not self.ai.data['buoyData'].has_key(vision.Color.RED))
        self.assertCurrentState(self._myState)
示例#4
0
    def testBuoyLost(self):
        """
        Buoy data should be deleted and the state should change to the
        lost state
        """
        # Setup the dictionary as if we had received a found event
        event = vision.BuoyEvent(0.0, 0.0, vision.Color.YELLOW)
        self.ai.data['buoyData'][vision.Color.YELLOW] = event

        self.injectEvent(vision.EventType.BUOY_LOST, vision.BuoyEvent,
                         color = vision.Color.YELLOW)
        #self.assert_(not self.ai.data['buoyData'].has_key(vision.Color.YELLOW))
        self.assertCurrentState(self._lostState)
示例#5
0
    def testBuoyLost(self):
        """Make sure losing the light goes back to search"""
        BuoyTrackingTest.testBuoyLost(self)

        # Add a lastLightEvent for FindAttempt
        self.ai.data['buoyData'][vision.Color.YELLOW] = \
            vision.BuoyEvent(0, 0, vision.Color.YELLOW)
        self.injectEvent(vision.EventType.LIGHT_LOST, vision.BuoyEvent,
                         color = vision.Color.YELLOW)
        self.assertCurrentState(buoy.FindAttemptSeek)

        # Test that it reenters Seek when it's refound
        self.injectEvent(vision.EventType.BUOY_FOUND, vision.BuoyEvent,
                         0, 0, vision.Color.YELLOW)
        self.assertCurrentState(buoy.Seek)