Ejemplo n.º 1
0
    def setUp(self):
        """Populates an active mission to test a cached view."""
        pos = GpsPosition()
        pos.latitude = 10
        pos.longitude = 10
        pos.save()
        self.pos = pos

        obst = StationaryObstacle()
        obst.gps_position = pos
        obst.cylinder_radius = 10
        obst.cylinder_height = 10
        obst.save()
        self.obst = obst

        config = MissionConfig()
        config.is_active = True
        config.home_pos = pos
        config.emergent_last_known_pos = pos
        config.off_axis_target_pos = pos
        config.air_drop_pos = pos
        config.save()
        self.config = config
        config.stationary_obstacles.add(obst)
        config.save()

        self.login_url = reverse('auvsi_suas:login')
        self.obst_url = reverse('auvsi_suas:obstacles')
        self.clear_cache_url = reverse('auvsi_suas:clear_cache')
Ejemplo n.º 2
0
    def setUp(self):
        """Populates an active mission to test a cached view."""
        pos = GpsPosition()
        pos.latitude = 10
        pos.longitude = 10
        pos.save()
        self.pos = pos

        obst = StationaryObstacle()
        obst.gps_position = pos
        obst.cylinder_radius = 10
        obst.cylinder_height = 10
        obst.save()
        self.obst = obst

        config = MissionConfig()
        config.is_active = True
        config.home_pos = pos
        config.emergent_last_known_pos = pos
        config.off_axis_target_pos = pos
        config.air_drop_pos = pos
        config.save()
        self.config = config
        config.stationary_obstacles.add(obst)
        config.save()

        self.login_url = reverse('auvsi_suas:login')
        self.obst_url = reverse('auvsi_suas:obstacles')
        self.clear_cache_url = reverse('auvsi_suas:clear_cache')
Ejemplo n.º 3
0
    def setUp(self):
        self.user = User.objects.create_user('testuser', '*****@*****.**',
                                             'testpass')
        self.user.save()

        # Create an active mission.
        pos = GpsPosition()
        pos.latitude = 10
        pos.longitude = 10
        pos.save()
        config = MissionConfig()
        config.is_active = True
        config.home_pos = pos
        config.emergent_last_known_pos = pos
        config.off_axis_target_pos = pos
        config.air_drop_pos = pos
        config.save()

        # Add a couple of stationary obstacles
        obst = self.create_stationary_obstacle(lat=38.142233,
                                               lon=-76.434082,
                                               radius=300,
                                               height=500)
        config.stationary_obstacles.add(obst)

        obst = self.create_stationary_obstacle(lat=38.442233,
                                               lon=-76.834082,
                                               radius=100,
                                               height=750)
        config.stationary_obstacles.add(obst)

        # And a couple of moving obstacles
        obst = self.create_moving_obstacle([
            # (lat,     lon,        alt)
            (38.142233, -76.434082, 300),
            (38.141878, -76.425198, 700),
        ])
        config.moving_obstacles.add(obst)

        obst = self.create_moving_obstacle([
            # (lat,     lon,        alt)
            (38.145405, -76.428310, 100),
            (38.146582, -76.424099, 200),
            (38.144662, -76.427634, 300),
            (38.147729, -76.419185, 200),
            (38.147573, -76.420832, 100),
            (38.148522, -76.419507, 750),
        ])
        config.moving_obstacles.add(obst)

        config.save()

        # Login
        response = self.client.post(login_url, {
            'username': '******',
            'password': '******'
        })
        self.assertEqual(200, response.status_code)
Ejemplo n.º 4
0
    def create_config(self):
        """Creates a dummy config for testing."""
        pos = GpsPosition()
        pos.latitude = 10
        pos.longitude = 10
        pos.save()

        config = MissionConfig()
        config.is_active = False
        config.home_pos = pos
        config.emergent_last_known_pos = pos
        config.off_axis_target_pos = pos
        config.air_drop_pos = pos
        return config
Ejemplo n.º 5
0
    def create_config(self):
        """Creates a dummy config for testing."""
        pos = GpsPosition()
        pos.latitude = 10
        pos.longitude = 10
        pos.save()

        config = MissionConfig()
        config.is_active = False
        config.home_pos = pos
        config.emergent_last_known_pos = pos
        config.off_axis_target_pos = pos
        config.air_drop_pos = pos
        return config
Ejemplo n.º 6
0
    def setUp(self):
        """Setup a single active mission to test live kml with."""
        super(TestGenerateLiveKMLNoFixture, self).setUp()

        pos = GpsPosition()
        pos.latitude = 10
        pos.longitude = 10
        pos.save()

        config = MissionConfig()
        config.is_active = True
        config.home_pos = pos
        config.emergent_last_known_pos = pos
        config.off_axis_target_pos = pos
        config.air_drop_pos = pos
        config.save()
        self.config = config
Ejemplo n.º 7
0
    def setUp(self):
        """Setup a single active mission to test live kml with."""
        super(TestGenerateLiveKMLNoFixture, self).setUp()

        pos = GpsPosition()
        pos.latitude = 10
        pos.longitude = 10
        pos.save()

        config = MissionConfig()
        config.is_active = True
        config.home_pos = pos
        config.emergent_last_known_pos = pos
        config.off_axis_target_pos = pos
        config.air_drop_pos = pos
        config.save()
        self.config = config
Ejemplo n.º 8
0
 def test_unicode(self):
     """Tests the unicode method executes."""
     pos = GpsPosition()
     pos.latitude = 10
     pos.longitude = 100
     pos.save()
     apos = AerialPosition()
     apos.altitude_msl = 1000
     apos.gps_position = pos
     apos.save()
     wpt = Waypoint()
     wpt.position = apos
     wpt.order = 10
     wpt.save()
     config = MissionConfig()
     config.home_pos = pos
     config.emergent_last_known_pos = pos
     config.off_axis_target_pos = pos
     config.air_drop_pos = pos
     config.save()
     config.mission_waypoints.add(wpt)
     config.search_grid_points.add(wpt)
     config.save()
     self.assertTrue(config.__unicode__())
Ejemplo n.º 9
0
 def test_unicode(self):
     """Tests the unicode method executes."""
     pos = GpsPosition()
     pos.latitude = 10
     pos.longitude = 100
     pos.save()
     apos = AerialPosition()
     apos.altitude_msl = 1000
     apos.gps_position = pos
     apos.save()
     wpt = Waypoint()
     wpt.position = apos
     wpt.order = 10
     wpt.save()
     config = MissionConfig()
     config.home_pos = pos
     config.emergent_last_known_pos = pos
     config.off_axis_target_pos = pos
     config.air_drop_pos = pos
     config.save()
     config.mission_waypoints.add(wpt)
     config.search_grid_points.add(wpt)
     config.save()
     self.assertTrue(config.__unicode__())
Ejemplo n.º 10
0
    def test_satisfied_waypoints(self):
        """Tests the evaluation of waypoints method."""
        # Create mission config
        gpos = GpsPosition()
        gpos.latitude = 10
        gpos.longitude = 10
        gpos.save()
        config = MissionConfig()
        config.home_pos = gpos
        config.emergent_last_known_pos = gpos
        config.off_axis_target_pos = gpos
        config.air_drop_pos = gpos
        config.save()

        # Create waypoints for config
        waypoints = [(38, -76, 100), (39, -77, 200), (40, -78, 0)]
        for i, waypoint in enumerate(waypoints):
            (lat, lon, alt) = waypoint
            pos = GpsPosition()
            pos.latitude = lat
            pos.longitude = lon
            pos.save()
            apos = AerialPosition()
            apos.altitude_msl = alt
            apos.gps_position = pos
            apos.save()
            wpt = Waypoint()
            wpt.position = apos
            wpt.order = i
            wpt.save()
            config.mission_waypoints.add(wpt)
        config.save()

        # Create UAS telemetry logs
        user = User.objects.create_user('testuser', '*****@*****.**',
                                        'testpass')

        # Only first is valid.
        entries = [(38, -76, 140), (40, -78, 600), (37, -75, 40)]
        expect = ({0: 40}, {0: 0.6, 1: 0.0, 2: 0.0}, {0: 40, 1: 460785.17})
        logs = self.create_uas_logs(user, entries)
        self.assertSatisfiedWaypoints(expect, config.satisfied_waypoints(logs))

        # First and last are valid, but missed second, so third doesn't count.
        entries = [(38, -76, 140), (40, -78, 600), (40, -78, 40)]
        expect = ({0: 40}, {0: 0.6, 1: 0.0, 2: 0.0}, {0: 40, 1: 460785.03})
        logs = self.create_uas_logs(user, entries)
        self.assertSatisfiedWaypoints(expect, config.satisfied_waypoints(logs))

        # Hit all.
        entries = [(38, -76, 140), (39, -77, 180), (40, -78, 40)]
        expect = ({0: 40, 1: 20, 2: 40},
                  {0: 0.6, 1: 0.8, 2: 0.6},
                  {0: 40, 1: 20, 2: 40}) # yapf: disable
        logs = self.create_uas_logs(user, entries)
        self.assertSatisfiedWaypoints(expect, config.satisfied_waypoints(logs))

        # Only hit the first waypoint on run one, hit all on run two.
        entries = [
            (38, -76, 140),
            (40, -78, 600),
            (37, -75, 40),
            # Run two:
            (38, -76, 140),
            (39, -77, 180),
            (40, -78, 40)
        ]
        expect = ({0: 40, 1: 20, 2: 40},
                  {0: 0.6, 1: 0.8, 2: 0.6},
                  {0: 40, 1: 20, 2: 40}) # yapf: disable
        logs = self.create_uas_logs(user, entries)
        self.assertSatisfiedWaypoints(expect, config.satisfied_waypoints(logs))

        # Hit all on run one, only hit the first waypoint on run two.
        entries = [
            (38, -76, 140),
            (39, -77, 180),
            (40, -78, 40),
            # Run two:
            (38, -76, 140),
            (40, -78, 600),
            (37, -75, 40)
        ]
        expect = ({0: 40, 1: 20, 2: 40},
                  {0: 0.6, 1: 0.8, 2: 0.6},
                  {0: 40, 1: 20, 2: 40}) # yapf: disable
        logs = self.create_uas_logs(user, entries)
        self.assertSatisfiedWaypoints(expect, config.satisfied_waypoints(logs))

        # Keep flying after hitting all waypoints.
        entries = [(38, -76, 140), (39, -77, 180), (40, -78, 40),
                   (30.1, -78.1, 100)]
        expect = ({0: 40, 1: 20, 2: 40},
                  {0: 0.6, 1: 0.8, 2: 0.6},
                  {0: 40, 1: 20, 2: 40}) # yapf: disable
        logs = self.create_uas_logs(user, entries)
        self.assertSatisfiedWaypoints(expect, config.satisfied_waypoints(logs))

        # Hit all in first run, but second is higher scoring.
        entries = [
            (38, -76, 140),
            (39, -77, 180),
            (40, -78, 60),
            # Run two:
            (38, -76, 100),
            (39, -77, 200),
            (40, -78, 110)
        ]
        expect = ({0: 0, 1: 0}, {0: 1, 1: 1, 2: 0}, {0: 0, 1: 0, 2: 60})
        logs = self.create_uas_logs(user, entries)
        self.assertSatisfiedWaypoints(expect, config.satisfied_waypoints(logs))

        # Restart waypoint path in the middle.
        waypoints = [(38, -76, 100), (39, -77, 200), (40, -78, 0)]
        entries = [
            (38, -76, 140),
            (39, -77, 180),
            # Restart:
            (38, -76, 70),
            (39, -77, 150),
            (40, -78, 10)
        ]
        expect = ({0: 30, 1: 50, 2: 10},
                  {0: 0.7, 1: 0.5, 2: 0.9},
                  {0: 30, 1: 20, 2: 10}) # yapf: disable
        logs = self.create_uas_logs(user, entries)
        self.assertSatisfiedWaypoints(expect, config.satisfied_waypoints(logs))
Ejemplo n.º 11
0
    def test_satisfied_waypoints(self):
        """Tests the evaluation of waypoints method."""
        # Create mission config
        gpos = GpsPosition()
        gpos.latitude = 10
        gpos.longitude = 10
        gpos.save()
        config = MissionConfig()
        config.home_pos = gpos
        config.emergent_last_known_pos = gpos
        config.off_axis_target_pos = gpos
        config.air_drop_pos = gpos
        config.save()

        # Create waypoints for config
        waypoints = [(38, -76, 100), (39, -77, 200), (40, -78, 0)]
        for i, waypoint in enumerate(waypoints):
            (lat, lon, alt) = waypoint
            pos = GpsPosition()
            pos.latitude = lat
            pos.longitude = lon
            pos.save()
            apos = AerialPosition()
            apos.altitude_msl = alt
            apos.gps_position = pos
            apos.save()
            wpt = Waypoint()
            wpt.position = apos
            wpt.order = i
            wpt.save()
            config.mission_waypoints.add(wpt)
        config.save()

        # Create UAS telemetry logs
        user = User.objects.create_user('testuser', '*****@*****.**',
                                        'testpass')

        def assertSatisfiedWaypoints(expect, got):
            """Assert two satisfied_waypoints return values are equal."""
            self.assertEqual(expect[0], got[0])
            self.assertEqual(expect[1], got[1])
            for k in expect[2].keys():
                self.assertIn(k, got[2])
                self.assertAlmostEqual(expect[2][k], got[2][k], delta=0.1)
            for k in got[2].keys():
                self.assertIn(k, expect[2])

        # Only first is valid.
        entries = [(38, -76, 140), (40, -78, 600), (37, -75, 40)]
        expect = (1, 1, {0: 40, 1: 460785.17})
        logs = self.create_uas_logs(user, entries)
        assertSatisfiedWaypoints(expect, config.satisfied_waypoints(logs))

        # First and last are valid, but missed second, so third doesn't count.
        entries = [(38, -76, 140), (40, -78, 600), (40, -78, 40)]
        expect = (1, 1, {0: 40, 1: 460785.03})
        logs = self.create_uas_logs(user, entries)
        assertSatisfiedWaypoints(expect, config.satisfied_waypoints(logs))

        # Hit all.
        entries = [(38, -76, 140), (39, -77, 180), (40, -78, 40)]
        expect = (3, 3, {0: 40, 1: 20, 2: 40})
        logs = self.create_uas_logs(user, entries)
        assertSatisfiedWaypoints(expect, config.satisfied_waypoints(logs))

        # Hit all, but don't stay within waypoint track.
        entries = [(38, -76, 140), (39, -77, 180), (41, -78, 40),
                   (40, -78, 40)]
        expect = (3, 2, {0: 40, 1: 20, 2: 40})
        logs = self.create_uas_logs(user, entries)
        assertSatisfiedWaypoints(expect, config.satisfied_waypoints(logs))

        # Only hit the first waypoint on run one, hit all on run two.
        entries = [(38, -76, 140),
                   (40, -78, 600),
                   (37, -75, 40),
                   # Run two:
                   (38, -76, 140),
                   (39, -77, 180),
                   (40, -78, 40)]
        expect = (3, 3, {0: 40, 1: 20, 2: 40})
        logs = self.create_uas_logs(user, entries)
        assertSatisfiedWaypoints(expect, config.satisfied_waypoints(logs))

        # Hit all on run one, only hit the first waypoint on run two.
        entries = [(38, -76, 140),
                   (39, -77, 180),
                   (40, -78, 40),
                   # Run two:
                   (38, -76, 140),
                   (40, -78, 600),
                   (37, -75, 40)]
        expect = (3, 3, {0: 40, 1: 20, 2: 40})
        logs = self.create_uas_logs(user, entries)
        assertSatisfiedWaypoints(expect, config.satisfied_waypoints(logs))

        # Remain on the waypoint track only on the second run.
        entries = [(38, -76, 140),
                   (39, -77, 180),
                   (41, -78, 40),
                   (40, -78, 40),
                   # Run two:
                   (38, -76, 140),
                   (39, -77, 180),
                   (40, -78, 40)]
        expect = (3, 3, {0: 40, 1: 20, 2: 40})
        logs = self.create_uas_logs(user, entries)
        assertSatisfiedWaypoints(expect, config.satisfied_waypoints(logs))

        # Keep flying after hitting all waypoints.
        entries = [(38, -76, 140), (39, -77, 180), (40, -78, 40),
                   (30.1, -78.1, 100)]
        expect = (3, 3, {0: 40, 1: 20, 2: 40})
        logs = self.create_uas_logs(user, entries)
        assertSatisfiedWaypoints(expect, config.satisfied_waypoints(logs))

        # Miss last target by a sane distance.
        entries = [(38, -76, 140), (39, -77, 180), (40, -78, 60)]
        expect = (2, 2, {0: 40, 1: 20, 2: 60})
        logs = self.create_uas_logs(user, entries)
        assertSatisfiedWaypoints(expect, config.satisfied_waypoints(logs))
Ejemplo n.º 12
0
    def test_satisfied_waypoints(self):
        """Tests the evaluation of waypoints method."""
        # Create mission config
        gpos = GpsPosition()
        gpos.latitude = 10
        gpos.longitude = 10
        gpos.save()
        config = MissionConfig()
        config.home_pos = gpos
        config.emergent_last_known_pos = gpos
        config.off_axis_target_pos = gpos
        config.air_drop_pos = gpos
        config.save()

        # Create waypoints for config
        waypoints = [(38, -76, 100), (39, -77, 200), (40, -78, 0)]
        for i, waypoint in enumerate(waypoints):
            (lat, lon, alt) = waypoint
            pos = GpsPosition()
            pos.latitude = lat
            pos.longitude = lon
            pos.save()
            apos = AerialPosition()
            apos.altitude_msl = alt
            apos.gps_position = pos
            apos.save()
            wpt = Waypoint()
            wpt.position = apos
            wpt.order = i
            wpt.save()
            config.mission_waypoints.add(wpt)
        config.save()

        # Create UAS telemetry logs
        user = User.objects.create_user('testuser', '*****@*****.**',
                                        'testpass')

        # Only first is valid.
        entries = [(38, -76, 140), (40, -78, 600), (37, -75, 40)]
        expect = ({0: 40}, {0: 0.6, 1: 0.0, 2: 0.0}, {0: 40, 1: 460785.17})
        logs = self.create_uas_logs(user, entries)
        self.assertSatisfiedWaypoints(expect, config.satisfied_waypoints(logs))

        # First and last are valid, but missed second, so third doesn't count.
        entries = [(38, -76, 140), (40, -78, 600), (40, -78, 40)]
        expect = ({0: 40}, {0: 0.6, 1: 0.0, 2: 0.0}, {0: 40, 1: 460785.03})
        logs = self.create_uas_logs(user, entries)
        self.assertSatisfiedWaypoints(expect, config.satisfied_waypoints(logs))

        # Hit all.
        entries = [(38, -76, 140), (39, -77, 180), (40, -78, 40)]
        expect = ({0: 40, 1: 20, 2: 40},
                  {0: 0.6, 1: 0.8, 2: 0.6},
                  {0: 40, 1: 20, 2: 40}) # yapf: disable
        logs = self.create_uas_logs(user, entries)
        self.assertSatisfiedWaypoints(expect, config.satisfied_waypoints(logs))

        # Only hit the first waypoint on run one, hit all on run two.
        entries = [(38, -76, 140),
                   (40, -78, 600),
                   (37, -75, 40),
                   # Run two:
                   (38, -76, 140),
                   (39, -77, 180),
                   (40, -78, 40)]
        expect = ({0: 40, 1: 20, 2: 40},
                  {0: 0.6, 1: 0.8, 2: 0.6},
                  {0: 40, 1: 20, 2: 40}) # yapf: disable
        logs = self.create_uas_logs(user, entries)
        self.assertSatisfiedWaypoints(expect, config.satisfied_waypoints(logs))

        # Hit all on run one, only hit the first waypoint on run two.
        entries = [(38, -76, 140),
                   (39, -77, 180),
                   (40, -78, 40),
                   # Run two:
                   (38, -76, 140),
                   (40, -78, 600),
                   (37, -75, 40)]
        expect = ({0: 40, 1: 20, 2: 40},
                  {0: 0.6, 1: 0.8, 2: 0.6},
                  {0: 40, 1: 20, 2: 40}) # yapf: disable
        logs = self.create_uas_logs(user, entries)
        self.assertSatisfiedWaypoints(expect, config.satisfied_waypoints(logs))

        # Keep flying after hitting all waypoints.
        entries = [(38, -76, 140), (39, -77, 180), (40, -78, 40),
                   (30.1, -78.1, 100)]
        expect = ({0: 40, 1: 20, 2: 40},
                  {0: 0.6, 1: 0.8, 2: 0.6},
                  {0: 40, 1: 20, 2: 40}) # yapf: disable
        logs = self.create_uas_logs(user, entries)
        self.assertSatisfiedWaypoints(expect, config.satisfied_waypoints(logs))

        # Hit all in first run, but second is higher scoring.
        entries = [(38, -76, 140),
                   (39, -77, 180),
                   (40, -78, 60),
                   # Run two:
                   (38, -76, 100),
                   (39, -77, 200),
                   (40, -78, 110)]
        expect = ({0: 0, 1: 0}, {0: 1, 1: 1, 2: 0}, {0: 0, 1: 0, 2: 60})
        logs = self.create_uas_logs(user, entries)
        self.assertSatisfiedWaypoints(expect, config.satisfied_waypoints(logs))

        # Restart waypoint path in the middle.
        waypoints = [(38, -76, 100), (39, -77, 200), (40, -78, 0)]
        entries = [(38, -76, 140),
                   (39, -77, 180),
                   # Restart:
                   (38, -76, 70),
                   (39, -77, 150),
                   (40, -78, 10)]
        expect = ({0: 30, 1: 50, 2: 10},
                  {0: 0.7, 1: 0.5, 2: 0.9},
                  {0: 30, 1: 20, 2: 10}) # yapf: disable
        logs = self.create_uas_logs(user, entries)
        self.assertSatisfiedWaypoints(expect, config.satisfied_waypoints(logs))
Ejemplo n.º 13
0
    def test_satisfied_waypoints(self):
        """Tests the evaluation of waypoints method."""
        # Create mission config
        gpos = GpsPosition()
        gpos.latitude = 10
        gpos.longitude = 10
        gpos.save()
        config = MissionConfig()
        config.home_pos = gpos
        config.emergent_last_known_pos = gpos
        config.off_axis_target_pos = gpos
        config.air_drop_pos = gpos
        config.save()

        # Create waypoints for config
        waypoints = [(38, -76, 100), (39, -77, 200), (40, -78, 0)]
        for i, waypoint in enumerate(waypoints):
            (lat, lon, alt) = waypoint
            pos = GpsPosition()
            pos.latitude = lat
            pos.longitude = lon
            pos.save()
            apos = AerialPosition()
            apos.altitude_msl = alt
            apos.gps_position = pos
            apos.save()
            wpt = Waypoint()
            wpt.position = apos
            wpt.order = i
            wpt.save()
            config.mission_waypoints.add(wpt)
        config.save()

        # Create UAS telemetry logs
        user = User.objects.create_user('testuser', '*****@*****.**',
                                        'testpass')

        def assertSatisfiedWaypoints(expect, got):
            """Assert two satisfied_waypoints return values are equal."""
            self.assertEqual(expect[0], got[0])
            self.assertEqual(expect[1], got[1])
            for k in expect[2].keys():
                self.assertIn(k, got[2])
                self.assertAlmostEqual(expect[2][k], got[2][k], delta=0.1)
            for k in got[2].keys():
                self.assertIn(k, expect[2])

        # Only first is valid.
        entries = [(38, -76, 140), (40, -78, 600), (37, -75, 40)]
        expect = (1, 1, {0: 40, 1: 460785.17})
        logs = self.create_uas_logs(user, entries)
        assertSatisfiedWaypoints(expect, config.satisfied_waypoints(logs))

        # First and last are valid, but missed second, so third doesn't count.
        entries = [(38, -76, 140), (40, -78, 600), (40, -78, 40)]
        expect = (1, 1, {0: 40, 1: 460785.03})
        logs = self.create_uas_logs(user, entries)
        assertSatisfiedWaypoints(expect, config.satisfied_waypoints(logs))

        # Hit all.
        entries = [(38, -76, 140), (39, -77, 180), (40, -78, 40)]
        expect = (3, 3, {0: 40, 1: 20, 2: 40})
        logs = self.create_uas_logs(user, entries)
        assertSatisfiedWaypoints(expect, config.satisfied_waypoints(logs))

        # Hit all, but don't stay within waypoint track.
        entries = [(38, -76, 140), (39, -77, 180), (41, -78, 40),
                   (40, -78, 40)]
        expect = (3, 2, {0: 40, 1: 20, 2: 40})
        logs = self.create_uas_logs(user, entries)
        assertSatisfiedWaypoints(expect, config.satisfied_waypoints(logs))

        # Only hit the first waypoint on run one, hit all on run two.
        entries = [
            (38, -76, 140),
            (40, -78, 600),
            (37, -75, 40),
            # Run two:
            (38, -76, 140),
            (39, -77, 180),
            (40, -78, 40)
        ]
        expect = (3, 3, {0: 40, 1: 20, 2: 40})
        logs = self.create_uas_logs(user, entries)
        assertSatisfiedWaypoints(expect, config.satisfied_waypoints(logs))

        # Hit all on run one, only hit the first waypoint on run two.
        entries = [
            (38, -76, 140),
            (39, -77, 180),
            (40, -78, 40),
            # Run two:
            (38, -76, 140),
            (40, -78, 600),
            (37, -75, 40)
        ]
        expect = (3, 3, {0: 40, 1: 20, 2: 40})
        logs = self.create_uas_logs(user, entries)
        assertSatisfiedWaypoints(expect, config.satisfied_waypoints(logs))

        # Remain on the waypoint track only on the second run.
        entries = [
            (38, -76, 140),
            (39, -77, 180),
            (41, -78, 40),
            (40, -78, 40),
            # Run two:
            (38, -76, 140),
            (39, -77, 180),
            (40, -78, 40)
        ]
        expect = (3, 3, {0: 40, 1: 20, 2: 40})
        logs = self.create_uas_logs(user, entries)
        assertSatisfiedWaypoints(expect, config.satisfied_waypoints(logs))

        # Keep flying after hitting all waypoints.
        entries = [(38, -76, 140), (39, -77, 180), (40, -78, 40),
                   (30.1, -78.1, 100)]
        expect = (3, 3, {0: 40, 1: 20, 2: 40})
        logs = self.create_uas_logs(user, entries)
        assertSatisfiedWaypoints(expect, config.satisfied_waypoints(logs))

        # Miss last target by a sane distance.
        entries = [(38, -76, 140), (39, -77, 180), (40, -78, 60)]
        expect = (2, 2, {0: 40, 1: 20, 2: 60})
        logs = self.create_uas_logs(user, entries)
        assertSatisfiedWaypoints(expect, config.satisfied_waypoints(logs))