Example #1
0
    def setUp(self):
        """Create the obstacles for testing."""
        # Obstacle with no waypoints
        obst_no_wpt = MovingObstacle()
        obst_no_wpt.speed_avg = 1
        obst_no_wpt.sphere_radius = 1
        obst_no_wpt.save()
        self.obst_no_wpt = obst_no_wpt

        # Obstacle with single waypoint
        self.single_wpt_lat = 40
        self.single_wpt_lon = 76
        self.single_wpt_alt = 100
        obst_single_wpt = MovingObstacle()
        obst_single_wpt.speed_avg = 1
        obst_single_wpt.sphere_radius = 1
        obst_single_wpt.save()
        single_gpos = GpsPosition()
        single_gpos.latitude = self.single_wpt_lat
        single_gpos.longitude = self.single_wpt_lon
        single_gpos.save()
        single_apos = AerialPosition()
        single_apos.gps_position = single_gpos
        single_apos.altitude_msl = self.single_wpt_alt
        single_apos.save()
        single_wpt = Waypoint()
        single_wpt.position = single_apos
        single_wpt.name = 'Waypoint'
        single_wpt.order = 1
        single_wpt.save()
        obst_single_wpt.waypoints.add(single_wpt)
        self.obst_single_wpt = obst_single_wpt

        # Obstacles with predefined path
        self.obstacles = list()
        for path in TESTDATA_MOVOBST_PATHS:
            cur_obst = MovingObstacle()
            cur_obst.name = 'MovingObstacle'
            cur_obst.speed_avg = 68
            cur_obst.sphere_radius = 10
            cur_obst.save()
            for pt_id in range(len(path)):
                (lat, lon, alt) = path[pt_id]
                cur_gpos = GpsPosition()
                cur_gpos.latitude = lat
                cur_gpos.longitude = lon
                cur_gpos.save()
                cur_apos = AerialPosition()
                cur_apos.gps_position = cur_gpos
                cur_apos.altitude_msl = alt
                cur_apos.save()
                cur_wpt = Waypoint()
                cur_wpt.position = cur_apos
                cur_wpt.name = 'Waypoint'
                cur_wpt.order = pt_id
                cur_wpt.save()
                cur_obst.waypoints.add(cur_wpt)
            cur_obst.save()
            self.obstacles.append(cur_obst)
Example #2
0
    def setUp(self):
        """Create the obstacles for testing."""
        # Obstacle with no waypoints
        obst_no_wpt = MovingObstacle()
        obst_no_wpt.speed_avg = 1
        obst_no_wpt.sphere_radius = 1
        obst_no_wpt.save()
        self.obst_no_wpt = obst_no_wpt

        # Obstacle with single waypoint
        self.single_wpt_lat = 40
        self.single_wpt_lon = 76
        self.single_wpt_alt = 100
        obst_single_wpt = MovingObstacle()
        obst_single_wpt.speed_avg = 1
        obst_single_wpt.sphere_radius = 1
        obst_single_wpt.save()
        single_gpos = GpsPosition()
        single_gpos.latitude = self.single_wpt_lat
        single_gpos.longitude = self.single_wpt_lon
        single_gpos.save()
        single_apos = AerialPosition()
        single_apos.gps_position = single_gpos
        single_apos.altitude_msl = self.single_wpt_alt
        single_apos.save()
        single_wpt = Waypoint()
        single_wpt.position = single_apos
        single_wpt.name = 'Waypoint'
        single_wpt.order = 1
        single_wpt.save()
        obst_single_wpt.waypoints.add(single_wpt)
        self.obst_single_wpt = obst_single_wpt

        # Obstacles with predefined path
        self.obstacles = list()
        for path in TESTDATA_MOVOBST_PATHS:
            cur_obst = MovingObstacle()
            cur_obst.name = 'MovingObstacle'
            cur_obst.speed_avg = 68
            cur_obst.sphere_radius = 10
            cur_obst.save()
            for pt_id in range(len(path)):
                (lat, lon, alt) = path[pt_id]
                cur_gpos = GpsPosition()
                cur_gpos.latitude = lat
                cur_gpos.longitude = lon
                cur_gpos.save()
                cur_apos = AerialPosition()
                cur_apos.gps_position = cur_gpos
                cur_apos.altitude_msl = alt
                cur_apos.save()
                cur_wpt = Waypoint()
                cur_wpt.position = cur_apos
                cur_wpt.name = 'Waypoint'
                cur_wpt.order = pt_id
                cur_wpt.save()
                cur_obst.waypoints.add(cur_wpt)
            cur_obst.save()
            self.obstacles.append(cur_obst)
Example #3
0
 def setUp(self):
     """Sets up the client, obstacle URL, obstacles, and user."""
     # Setup user
     self.user = User.objects.create_user('testuser', '*****@*****.**',
                                          'testpass')
     self.user.save()
     # Setup the obstacles
     for path in TESTDATA_MOVOBST_PATHS:
         # Stationary obstacle
         (stat_lat, stat_lon, _) = path[0]
         stat_gps = GpsPosition()
         stat_gps.latitude = stat_lat
         stat_gps.longitude = stat_lon
         stat_gps.save()
         stat_obst = StationaryObstacle()
         stat_obst.gps_position = stat_gps
         stat_obst.cylinder_radius = 100
         stat_obst.cylinder_height = 200
         stat_obst.save()
         # Moving obstacle
         mov_obst = MovingObstacle()
         mov_obst.speed_avg = 40
         mov_obst.sphere_radius = 100
         mov_obst.save()
         for pt_id in range(len(path)):
             # Obstacle waypoints
             (wpt_lat, wpt_lon, wpt_alt) = path[pt_id]
             gpos = GpsPosition()
             gpos.latitude = wpt_lat
             gpos.longitude = wpt_lon
             gpos.save()
             apos = AerialPosition()
             apos.altitude_msl = wpt_alt
             apos.gps_position = gpos
             apos.save()
             wpt = Waypoint()
             wpt.name = 'test waypoint'
             wpt.order = pt_id
             wpt.position = apos
             wpt.save()
             mov_obst.waypoints.add(wpt)
         mov_obst.save()
     # Setup test objs
     self.client = Client()
     self.loginUrl = reverse('auvsi_suas:login')
     self.obstUrl = reverse('auvsi_suas:obstacles')
Example #4
0
 def setUp(self):
     """Sets up the client, obstacle URL, obstacles, and user."""
     # Setup user
     self.user = User.objects.create_user(
             'testuser', '*****@*****.**', 'testpass')
     self.user.save()
     # Setup the obstacles
     for path in TESTDATA_MOVOBST_PATHS:
         # Stationary obstacle
         (stat_lat, stat_lon, _) = path[0]
         stat_gps = GpsPosition()
         stat_gps.latitude = stat_lat
         stat_gps.longitude = stat_lon
         stat_gps.save()
         stat_obst = StationaryObstacle()
         stat_obst.gps_position = stat_gps
         stat_obst.cylinder_radius = 100
         stat_obst.cylinder_height = 200
         stat_obst.save()
         # Moving obstacle
         mov_obst = MovingObstacle()
         mov_obst.speed_avg = 40
         mov_obst.sphere_radius = 100
         mov_obst.save()
         for pt_id  in range(len(path)):
             # Obstacle waypoints
             (wpt_lat, wpt_lon, wpt_alt) = path[pt_id]
             gpos = GpsPosition()
             gpos.latitude = wpt_lat
             gpos.longitude = wpt_lon
             gpos.save()
             apos = AerialPosition()
             apos.altitude_msl = wpt_alt
             apos.gps_position = gpos
             apos.save()
             wpt = Waypoint()
             wpt.name = 'test waypoint'
             wpt.order = pt_id
             wpt.position = apos
             wpt.save()
             mov_obst.waypoints.add(wpt)
         mov_obst.save()
     # Setup test objs
     self.client = Client()
     self.loginUrl = reverse('auvsi_suas:login')
     self.obstUrl = reverse('auvsi_suas:obstacles')