示例#1
0
 def testSetOuterBoundaries(self):
     gVars.currentData.gps_coord = datatypes.GPSCoordinate(49, -123.1)
     coordinate = datatypes.GPSCoordinate(49, -123)  #same coordinate
     radius = 50
     boundary1 = datatypes.Boundary(coordinate, radius)
     coordinate = datatypes.GPSCoordinate(49, -123.1)  #same coordinate
     radius = 50
     boundary2 = datatypes.Boundary(coordinate, radius)
     boundaries = [boundary1, boundary2]
     self.assertEqual(self.boundaryHandler.getInnerBoundaries(boundaries),
                      [boundary2])
示例#2
0
 def testSetInstructionsWithNavChallenge(self):
     self.resetGlobVar()
     self.instructions = datatypes.Instructions(
         sVars.NAVIGATION_CHALLENGE,
         [datatypes.Waypoint(datatypes.GPSCoordinate(1, 1), sVars.GO_TO)],
         [datatypes.Boundary(datatypes.GPSCoordinate(1, 1), 1)], "port", 0)
     self.gui_handler.setInstructions(self.instructions)
     self.assertTrue(gVars.instructions, self.instructions)
     self.assertListEqual(gVars.functionQueue, [sVars.NAVIGATION_CHALLENGE])
     self.assertEqual(gVars.queueParameters[0][0].coordinate.lat, 1)
示例#3
0
    def testOutsideHitBoundaries(self):
        gVars.currentData.gps_coord = datatypes.GPSCoordinate(49, -123)
        gVars.boundaries = []
        coordinate = datatypes.GPSCoordinate(49, -123.1)  #11ish km west
        radius = 50
        boundary = datatypes.Boundary(coordinate, radius)
        gVars.boundaries.append(boundary)
        self.boundaryHandler.innerBoundaries = self.boundaryHandler.getInnerBoundaries(
            gVars.boundaries)
        self.boundaryHandler.outerBoundaries = self.boundaryHandler.getOuterBoundaries(
            gVars.boundaries)

        self.assertFalse(self.boundaryHandler.checkInnerBoundaryInterception())
示例#4
0
 def initControlInstructionsObject(self, instructions):
     waypointsList = []
     boundariesList = []
     for wpt in instructions['waypoints']:
         coordinate = control.GPSCoordinate(wpt[0], wpt[1])
         waypointsList.append(control.Waypoint(coordinate, wpt[2]))
     for bnd in instructions['boundaries']:
         coordinate = control.GPSCoordinate(bnd[0], bnd[1])
         boundariesList.append(control.Boundary(coordinate, bnd[2]))
     controlInstructions = control.Instructions(
         instructions['challenge'], waypointsList, boundariesList,
         instructions['rounding'], instructions['SK_exit_speed'])
     return controlInstructions
示例#5
0
    def testInsideHitBoundaries(self):
        gVars.currentData.gps_coord = datatypes.GPSCoordinate(49, -123.1)
        gVars.boundaries = []
        coordinate = datatypes.GPSCoordinate(49, -123)  #same coordinate
        radius = 50
        boundary = datatypes.Boundary(coordinate, radius)
        gVars.boundaries = [boundary]
        self.boundaryHandler.innerBoundaries = self.boundaryHandler.getInnerBoundaries(
            gVars.boundaries)
        self.boundaryHandler.outerBoundaries = self.boundaryHandler.getOuterBoundaries(
            gVars.boundaries)
        gVars.currentData.gps_coord = datatypes.GPSCoordinate(49, -123)
        self.assertTrue(len(self.boundaryHandler.outerBoundaries) > 0)

        self.assertTrue(self.boundaryHandler.checkOuterBoundaryInterception())
示例#6
0
 def setUp(self):
     self.x = datatype.Boundary(datatype.GPSCoordinate())
     self.y = datatype.Boundary(datatype.GPSCoordinate(42, -121), 123.456)