Beispiel #1
0
    def setUp(self):
        pos = GpsPosition()
        pos.latitude = 10
        pos.longitude = 100
        pos.save()
        wpt = Waypoint()
        wpt.order = 10
        wpt.latitude = 10
        wpt.longitude = 100
        wpt.altitude_msl = 1000
        wpt.save()
        config = MissionConfig()
        config.home_pos = pos
        config.lost_comms_pos = pos
        config.emergent_last_known_pos = pos
        config.off_axis_odlc_pos = pos
        config.map_center_pos = pos
        config.map_height_ft = 1
        config.air_drop_pos = pos
        config.ugv_drive_pos = pos
        config.save()
        config.mission_waypoints.add(wpt)
        config.search_grid_points.add(wpt)
        config.save()

        user = User.objects.create_user('user', '*****@*****.**', 'pass')

        self.feedback = MissionJudgeFeedback(
            mission=config,
            user=user,
            flight_time=datetime.timedelta(seconds=1),
            post_process_time=datetime.timedelta(seconds=2),
            used_timeout=True,
            min_auto_flight_time=True,
            safety_pilot_takeovers=3,
            out_of_bounds=6,
            unsafe_out_of_bounds=7,
            things_fell_off_uas=False,
            crashed=False,
            air_drop_accuracy=interop_admin_api_pb2.MissionJudgeFeedback.
            WITHIN_05_FT,
            ugv_drove_to_location=False,
            operational_excellence_percent=9)
        self.feedback.save()
Beispiel #2
0
    def setUp(self):
        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_odlc_pos = pos
        config.air_drop_pos = pos
        config.save()
        config.mission_waypoints.add(wpt)
        config.search_grid_points.add(wpt)
        config.save()

        user = User.objects.create_user('user', '*****@*****.**', 'pass')

        self.feedback = MissionJudgeFeedback(
            mission=config,
            user=user,
            flight_time=datetime.timedelta(seconds=1),
            post_process_time=datetime.timedelta(seconds=2),
            used_timeout=True,
            min_auto_flight_time=True,
            safety_pilot_takeovers=3,
            waypoints_captured=5,
            out_of_bounds=6,
            unsafe_out_of_bounds=7,
            things_fell_off_uas=False,
            crashed=False,
            air_delivery_accuracy_ft=8,
            operational_excellence_percent=9)
        self.feedback.save()
Beispiel #3
0
class TestMissionJudgeFeedback(TestCase):
    def setUp(self):
        pos = GpsPosition()
        pos.latitude = 10
        pos.longitude = 100
        pos.save()
        wpt = Waypoint()
        wpt.order = 10
        wpt.latitude = 10
        wpt.longitude = 100
        wpt.altitude_msl = 1000
        wpt.save()
        config = MissionConfig()
        config.home_pos = pos
        config.emergent_last_known_pos = pos
        config.off_axis_odlc_pos = pos
        config.air_drop_pos = pos
        config.save()
        config.mission_waypoints.add(wpt)
        config.search_grid_points.add(wpt)
        config.save()

        user = User.objects.create_user('user', '*****@*****.**', 'pass')

        self.feedback = MissionJudgeFeedback(
            mission=config,
            user=user,
            flight_time=datetime.timedelta(seconds=1),
            post_process_time=datetime.timedelta(seconds=2),
            used_timeout=True,
            min_auto_flight_time=True,
            safety_pilot_takeovers=3,
            waypoints_captured=5,
            out_of_bounds=6,
            unsafe_out_of_bounds=7,
            things_fell_off_uas=False,
            crashed=False,
            air_drop_accuracy=interop_admin_api_pb2.MissionJudgeFeedback.
            WITHIN_05_FT,
            ugv_drove_to_location=False,
            operational_excellence_percent=9)
        self.feedback.save()

    def test_clean(self):
        """Test model validation."""
        self.feedback.full_clean()

    def test_proto(self):
        """Tests proto()."""
        pb = self.feedback.proto()

        self.assertAlmostEqual(1, pb.flight_time_sec)
        self.assertAlmostEqual(2, pb.post_process_time_sec)
        self.assertTrue(pb.used_timeout)
        self.assertTrue(pb.min_auto_flight_time)
        self.assertEqual(3, pb.safety_pilot_takeovers)
        self.assertEqual(5, pb.waypoints_captured)
        self.assertEqual(6, pb.out_of_bounds)
        self.assertEqual(7, pb.unsafe_out_of_bounds)
        self.assertFalse(pb.things_fell_off_uas)
        self.assertFalse(pb.crashed)
        self.assertAlmostEqual(
            interop_admin_api_pb2.MissionJudgeFeedback.WITHIN_05_FT,
            pb.air_drop_accuracy)
        self.assertFalse(pb.ugv_drove_to_location)
        self.assertAlmostEqual(9, pb.operational_excellence_percent)
Beispiel #4
0
def simulate_team_mission(test, mission, superuser, user):
    """Simulates a team's mission demonstration.

    Args:
        test: The test case.
        mission: The mission to simulate for.
        superuser: The superuser for admin actions.
        user: The user for the team.
    """
    total_telem = 100
    waypoints_hit = len(mission.mission_waypoints.all())
    odlcs_correct = len(mission.odlcs.all())
    odlcs_incorrect = 1

    c = Client()
    c.force_login(user)

    # Send telemetry during flight.
    TakeoffOrLandingEvent(user=user, mission=mission, uas_in_air=True).save()
    for i in range(total_telem):
        simulate_telemetry(test,
                           client=c,
                           mission=mission,
                           hit_waypoint=i < waypoints_hit)
    TakeoffOrLandingEvent(user=user, mission=mission, uas_in_air=False).save()

    # Submit ODLCs.
    for _ in range(odlcs_correct):
        simulate_odlc(test, c, mission, actual=True)
    for _ in range(odlcs_incorrect):
        simulate_odlc(test, c, mission, actual=False)

    # Judge feedback submitted.
    feedback = MissionJudgeFeedback()
    feedback.mission = mission
    feedback.user = user
    feedback.flight_time = datetime.timedelta(seconds=1)
    feedback.post_process_time = datetime.timedelta(seconds=1)
    feedback.used_timeout = False
    feedback.min_auto_flight_time = True
    feedback.safety_pilot_takeovers = 1
    feedback.waypoints_captured = len(mission.mission_waypoints.all()) / 2
    feedback.out_of_bounds = 1
    feedback.unsafe_out_of_bounds = 0
    feedback.things_fell_off_uas = 0
    feedback.crashed = False
    feedback.air_drop_accuracy = interop_admin_api_pb2.MissionJudgeFeedback.WITHIN_25_FT
    feedback.ugv_drove_to_location = True
    feedback.operational_excellence_percent = 90
    feedback.save()

    # ODLCs thumbnails reviewed.
    c = Client()
    c.force_login(superuser)
    review_data = json.loads(c.get(odlcs_review_url).content)
    for odlc_review in review_data:
        pk = int(odlc_review['odlc']['id'])
        review = interop_admin_api_pb2.OldcReview()
        review.odlc.id = pk
        review.thumbnail_approved = True
        review.description_approved = True
        r = client.put(odlc_review_id_url(args=[pk]),
                       data=json_format.MessageToJson(review),
                       content_type='application/json')
        test.assertEqual(r.status_code, 200, r.content)
Beispiel #5
0
class TestMissionJudgeFeedback(TestCase):
    def setUp(self):
        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_odlc_pos = pos
        config.air_drop_pos = pos
        config.save()
        config.mission_waypoints.add(wpt)
        config.search_grid_points.add(wpt)
        config.save()

        user = User.objects.create_user('user', '*****@*****.**', 'pass')

        self.feedback = MissionJudgeFeedback(
            mission=config,
            user=user,
            flight_time=datetime.timedelta(seconds=1),
            post_process_time=datetime.timedelta(seconds=2),
            used_timeout=True,
            min_auto_flight_time=True,
            safety_pilot_takeovers=3,
            waypoints_captured=5,
            out_of_bounds=6,
            unsafe_out_of_bounds=7,
            things_fell_off_uas=False,
            crashed=False,
            air_delivery_accuracy_ft=8,
            operational_excellence_percent=9)
        self.feedback.save()

    def test_unicode(self):
        """Tests __unicode__()."""
        self.assertIsNotNone(self.feedback.__unicode__())

    def test_proto(self):
        """Tests proto()."""
        pb = self.feedback.proto()

        self.assertAlmostEqual(1, pb.flight_time_sec)
        self.assertAlmostEqual(2, pb.post_process_time_sec)
        self.assertTrue(pb.used_timeout)
        self.assertTrue(pb.min_auto_flight_time)
        self.assertEqual(3, pb.safety_pilot_takeovers)
        self.assertEqual(5, pb.waypoints_captured)
        self.assertEqual(6, pb.out_of_bounds)
        self.assertEqual(7, pb.unsafe_out_of_bounds)
        self.assertFalse(pb.things_fell_off_uas)
        self.assertFalse(pb.crashed)
        self.assertAlmostEqual(8, pb.air_delivery_accuracy_ft)
        self.assertAlmostEqual(9, pb.operational_excellence_percent)

        self.feedback.air_delivery_accuracy_ft = None
        pb = self.feedback.proto()

        self.assertFalse(pb.HasField('air_delivery_accuracy_ft'))