Beispiel #1
0
    def create_spoofs(self):
        sg = SpoofGenerator()
        empty = PerceptionObjectArray()
        stc = PerceptionObjectArray()
        stc_shooter = PerceptionObjectArray()
        stc_obj = PerceptionObject()
        stc_obj.name = "scan_the_code"
        shooter_obj = PerceptionObject()
        shooter_obj.name = "shooter"
        empty.objects = []
        stc.objects = [stc_obj]
        stc_shooter.objects = [stc_obj, shooter_obj]
        empty_resp = ObjectDBQueryResponse()
        stc_resp = ObjectDBQueryResponse()
        stc_resp.objects = [stc_obj]
        service = sg.spoof_service("/database/requests", ObjectDBQuery, [empty_resp])
        yield service.start(self.nh)

        self.pub_base_mission = sg.spoof_publisher("/database/objects", PerceptionObjectArray, [empty, stc], [5, 1000])
        self.pub_normal_1 = sg.spoof_publisher("/database/objects", PerceptionObjectArray, [empty, stc, stc_shooter], [5, 5, 100])
        self.pub_normal_2 = sg.spoof_publisher("/database/objects", PerceptionObjectArray, [empty, stc, stc_shooter], [5, 5, 100])
        self.pub_fail_mission = sg.spoof_publisher("/database/objects", PerceptionObjectArray, [], [])
        self.pub_missing_objects = sg.spoof_publisher("/database/objects", PerceptionObjectArray, [stc, empty, stc], [4, 10, 100])
        self.timeout = sg.spoof_publisher("/database/objects", PerceptionObjectArray, [], [])
        self.obj_appear = sg.spoof_publisher("/database/objects", PerceptionObjectArray, [empty, stc], [3, 10000])
    def create_spoofs(self):
        sg = SpoofGenerator()
        empty = PerceptionObjectArray()
        stc = PerceptionObjectArray()
        stc_shooter = PerceptionObjectArray()
        stc_obj = PerceptionObject()
        stc_obj.name = "scan_the_code"
        shooter_obj = PerceptionObject()
        shooter_obj.name = "shooter"
        empty.objects = []
        stc.objects = [stc_obj]
        stc_shooter.objects = [stc_obj, shooter_obj]
        empty_resp = ObjectDBQueryResponse()
        stc_resp = ObjectDBQueryResponse()
        stc_resp.objects = [stc_obj]
        stc_resp.found = True
        self.service = sg.spoof_service("/database/requests", ObjectDBQuery, [empty_resp])
        self.service_missing = sg.spoof_service("/database/requests", ObjectDBQuery,
                                                [stc_resp, empty_resp, empty_resp, stc_resp])

        self.pub_base_mission = sg.spoof_publisher("/database/objects", PerceptionObjectArray, [empty, stc], [5, 1000])
        self.pub_normal_1 = sg.spoof_publisher("/database/objects", PerceptionObjectArray,
                                               [empty, stc, stc_shooter], [5, 5, 100])
        self.pub_normal_2 = sg.spoof_publisher("/database/objects", PerceptionObjectArray,
                                               [empty, stc, stc_shooter], [5, 5, 100])
        self.pub_fail_mission = sg.spoof_publisher("/database/objects", PerceptionObjectArray, [], [])
        self.pub_missing_objects = sg.spoof_publisher(
            "/database/objects", PerceptionObjectArray, [stc, empty, stc], [4, 10, 100])
        self.timeout = sg.spoof_publisher("/database/objects", PerceptionObjectArray, [], [])
        self.obj_appear = sg.spoof_publisher("/database/objects", PerceptionObjectArray, [empty, stc], [3, 10000])
    def create_spoofs(self):
        sg = SpoofGenerator()
        empty = PerceptionObjectArray()
        stc = PerceptionObjectArray()
        stc_shooter = PerceptionObjectArray()

        stc_obj = PerceptionObject()
        stc_obj.name = "ScanTheCode"
        stc_obj.position = Point(1, 1, 1)
        shooter_obj = PerceptionObject()
        shooter_obj.name = "Shooter"
        shooter_obj.position = Point(2, 2, 2)

        empty.objects = []
        stc.objects = [stc_obj]
        stc_shooter.objects = [stc_obj, shooter_obj]

        empty_resp = ObjectDBQueryResponse()
        all_marker = ObjectDBQueryResponse()
        stc_response = ObjectDBQueryResponse()
        shooter_response = ObjectDBQueryResponse()

        all_marker.found = True

        all_marker.objects = [stc_obj, shooter_obj]
        all_marker.found = True

        stc_response.objects = [stc_obj]
        stc_response.found = True

        shooter_response.objects = [shooter_obj]
        shooter_response.found = True

        odom = Odometry()
        odom.pose.pose.position = Point(0, 0, 0)

        self.pub_base_mission = sg.spoof_publisher("/odom", Odometry, [odom], [100000])

        self.serv_empty = sg.spoof_service("/database/requests", ObjectDBQuery, [empty_resp])

        self.serv_markers = sg.spoof_service("/database/requests", ObjectDBQuery, [all_marker])

        self.serv_normal_mission = sg.spoof_service(
            "/database/requests",
            ObjectDBQuery,
            [
                stc_response,
                shooter_response,
                stc_response,
                stc_response,
                shooter_response,
                shooter_response,
                stc_response,
            ],
        )

        self.serv_missing_marker = sg.spoof_service(
            "/database/requests",
            ObjectDBQuery,
            [
                empty_resp,
                stc_response,
                shooter_response,
                stc_response,
                stc_response,
                shooter_response,
                shooter_response,
                stc_response,
            ],
        )

        self.markers = sg.spoof_publisher("/database/objects", PerceptionObjectArray, [stc_shooter], [1000])

        self.empty = sg.spoof_publisher("/database/objects", PerceptionObjectArray, [empty], [1000])
Beispiel #4
0
    def create_spoofs(self):
        sg = SpoofGenerator()
        empty = PerceptionObjectArray()
        stc = PerceptionObjectArray()
        stc_shooter = PerceptionObjectArray()

        stc_marker_obj = PerceptionObject()
        stc_marker_obj.name = "Scan_The_Code"
        stc_marker_obj.position = Point(1, 1, 1)
        shooter_marker_obj = PerceptionObject()
        shooter_marker_obj.name = "Shooter"
        shooter_marker_obj.position = Point(2, 2, 2)

        stc_obj = PerceptionObject()
        stc_obj.name = "scan_the_code"
        stc_obj.position = Point(1, 1, 1)
        shooter_obj = PerceptionObject()
        shooter_obj.name = "shooter"
        shooter_obj.position = Point(2, 2, 2)

        empty.objects = []
        stc.objects = [stc_marker_obj]
        stc_shooter.objects = [stc_marker_obj, shooter_marker_obj]

        empty_resp = ObjectDBQueryResponse()
        all_marker = ObjectDBQueryResponse()
        stc_response = ObjectDBQueryResponse()
        shooter_response = ObjectDBQueryResponse()

        all_marker.found = True

        all_marker.objects = [stc_marker_obj, shooter_marker_obj]
        all_marker.found = True

        stc_response.objects = [stc_marker_obj]
        stc_response.found = True

        shooter_response.objects = [shooter_marker_obj]
        shooter_response.found = True

        odom = Odometry()
        odom.pose.pose.position = Point(0, 0, 0)

        self.pub_base_mission = sg.spoof_publisher("/odom", Odometry, [odom],
                                                   [100000])

        self.serv_empty = sg.spoof_service("/database/requests", ObjectDBQuery,
                                           [empty_resp])

        self.serv_markers = sg.spoof_service("/database/requests",
                                             ObjectDBQuery, [all_marker])
        self.serv_markers_empty = sg.spoof_service(
            "/database/requests", ObjectDBQuery, [
                empty_resp, all_marker, all_marker, all_marker, all_marker,
                all_marker, all_marker, all_marker, all_marker, all_marker,
                all_marker, all_marker, all_marker, all_marker, all_marker,
                all_marker, all_marker
            ])

        # self.missing_marker = sg.spoof_service("/database/requests", ObjectDBQuery, [stc_response,
        #                                                                                   shooter_response,
        #                                                                                   stc_response,
        #                                                                                   stc_response,
        #                                                                                   shooter_response,
        #                                                                                   shooter_response,
        #                                                                                   stc_response])

        # self.serv_missing_marker = sg.spoof_service("/database/requests", ObjectDBQuery, [empty_resp,
        #                                                                                   stc_response,
        #                                                                                   shooter_response,
        #                                                                                   stc_response,
        #                                                                                   stc_response,
        #                                                                                   shooter_response,
        #                                                                                   shooter_response,
        #                                                                                   stc_response])

        self.markers = sg.spoof_publisher("/database/objects",
                                          PerceptionObjectArray, [stc_shooter],
                                          [1000])

        self.empty = sg.spoof_publisher("/database/objects",
                                        PerceptionObjectArray, [empty], [1000])