Exemple #1
0
def main():
    tello_center.register_service(
        tello_center.ConfigService(
            config={
                tello_abs.TelloBackendService.CONFIG_STOP:
                True,
                tello_abs.TelloBackendService.CONFIG_AUTO_WAIT_FOR_START_IMAGE_AND_STATE:
                True,
                YoloService.CONFIG_LOOP_DETECTION:
                True,
                YoloService.CONFIG_DETECT_ON_MAIN_THREAD:
                True,
                YoloService.CONFIG_YOLO_WEIGHTS:
                'fire_89.pt',
                YoloService.CONFIG_USE_YOLO:
                False,

                # FPS config
                tello_center.FpsRecoder.key(tello_abs.MyTello.KEY_VIDEO_FPS):
                False,
                tello_center.FpsRecoder.key(tello_abs.MyTello.KEY_STATE_FPS):
                False,
                tello_center.FpsRecoder.key(tello_image_process.ImageProcessService.KEY_FPS):
                False
            }))
    tello_center.register_service(
        tello_center.PreLoadService(tasks=[YoloService.preload]))
    tello_center.register_service(tello_abs.TelloBackendService())  # 提供基础控制和数据
    tello_center.register_service(tello_abs.ReactiveImageAndStateService())
    tello_center.register_service(tello_image_process.ImageProcessService())
    tello_center.register_service(YoloService())
    tello_center.start_all_service()
    tello_center.lock_loop()
Exemple #2
0
def main():
    tello_center.register_service(tello_center.ConfigService(config={
        # main config
        tello_center.ConfigService.CONFIG_DEBUG: True,

        # Tello backend config
        tello_abs.TelloBackendService.CONFIG_STOP: False,
        tello_abs.TelloBackendService.CONFIG_AUTO_WAIT_FOR_START_IMAGE_AND_STATE: True,

        # Yolo config
        tello_yolo.YoloService.CONFIG_LOOP_DETECTION: False,
        tello_yolo.YoloService.CONFIG_DETECT_ON_MAIN_THREAD: True,
        tello_yolo.YoloService.CONFIG_USE_YOLO: False,

        # FPS config
        tello_center.FpsRecoder.key(tello_abs.MyTello.KEY_VIDEO_FPS): False,
        tello_center.FpsRecoder.key(tello_abs.MyTello.KEY_STATE_FPS): False,
        tello_center.FpsRecoder.key(tello_image_process.ImageProcessService.KEY_FPS): False,

        tello_judge_client.JudgeServerLocal.CONFIG_BOX_INFO: {
            1: tello_judge_client.IDX_CAT,
            2: tello_judge_client.IDX_GAS_TANK,
            3: tello_judge_client.IDX_BABY,
            4: tello_judge_client.IDX_FILES,
            5: tello_judge_client.IDX_PAINTING
        }
    }))
    tello_center.register_service(tello_center.PreLoadService(tasks=[
        tello_yolo.YoloService.preload
    ]))
    tello_center.register_service(tello_imshow.ImshowService())
    tello_center.register_service(tello_abs.TelloBackendService())  # 提供基础控制和数据
    tello_center.register_service(tello_abs.ReactiveImageAndStateService())
    if tello_center.debug():
        tello_center.register_service(tello_image_process.ImageProcessService(handlers=[
            # tello_image_process.ProxyImageHandler(tello_image_process.FireDetector)
        ]))  # 提供图片预览
    tello_center.register_service(tello_judge_client.JudgeServerLocal())
    tello_center.register_service(tello_judge_client.JudgeClientService())
    tello_center.register_service(tello_world.WorldService())  # 世界模型,提供碰撞检测
    # tello_center.register_service(tello_panda.PandaService())  # 提供3D模型预览
    tello_center.register_service(tello_yolo.YoloService())
    tello_center.register_service(tello_control.MainControl())
    tello_center.start_all_service()
    tello_center.lock_loop()
Exemple #3
0
            if self.call_exit:
                raise BaseException()

        startup.task_mgr.add(spinCameraTask, 'spinCameraTask')
        # startup.task_mgr.add(exitTask, 'exitTask')

        tello_center.input_exit_thread()
        try:
            startup.run()
        except SystemExit:
            tello_center.call_request_exit()


if __name__ == '__main__':
    tello_center.register_service(tello_center.ConfigService(config={
        tello_abs.TelloBackendService.CONFIG_STOP: True,
        tello_abs.TelloBackendService.CONFIG_AUTO_WAIT_FOR_START_IMAGE_AND_STATE: True
    }))
    tello_center.register_service(tello_center.PreLoadService(tasks=[
        tello_image_process.ImageProcessService.preload
    ]))
    tello_center.register_service(tello_abs.TelloBackendService())  # 提供基础控制和数据
    tello_center.register_service(tello_abs.ReactiveImageAndStateService())
    tello_center.register_service(tello_image_process.ImageProcessService(handlers=[
        # tello_image_process.ProxyImageHandler(tello_image_process.FireDetector)
    ]))  # 提供图片处理
    tello_center.register_service(tello_world.WorldService())  # 世界模型,提供碰撞检测
    tello_center.register_service(PandaService())  # 提供3D模型预览
    tello_center.start_all_service()
    tello_center.lock_loop()
Exemple #4
0
if __name__ == '__main__':
    tello_center.register_service(
        tello_center.ConfigService(
            config={
                # main config
                tello_center.ConfigService.CONFIG_DEBUG:
                True,

                # Tello backend config
                tello_abs.TelloBackendService.CONFIG_STOP:
                False,
                tello_abs.TelloBackendService.CONFIG_AUTO_WAIT_FOR_START_IMAGE_AND_STATE:
                True,

                # Yolo config
                tello_yolo.YoloService.CONFIG_LOOP_DETECTION:
                False,
                tello_yolo.YoloService.CONFIG_DETECT_ON_MAIN_THREAD:
                True,
                tello_yolo.YoloService.CONFIG_USE_YOLO:
                False,

                # FPS config
                tello_center.FpsRecoder.key(tello_abs.MyTello.KEY_VIDEO_FPS):
                False,
                tello_center.FpsRecoder.key(tello_abs.MyTello.KEY_STATE_FPS):
                False,
                tello_center.FpsRecoder.key(tello_image_process.ImageProcessService.KEY_FPS):
                False,
            }))

    tello_center.register_service(
Exemple #5
0
                    self.preload.put_loaded(FireDetector.PRELOAD_FIRE_POS,
                                            np.copy(pos))
                elif self.pos_handler is not None:
                    self.pos_handler(None)


if __name__ == '__main__':
    tello_center.register_service(
        tello_center.ConfigService(
            config={
                tello_abs.TelloBackendService.CONFIG_STOP:
                True,
                tello_abs.TelloBackendService.CONFIG_AUTO_WAIT_FOR_START_IMAGE_AND_STATE:
                True,

                # FPS config
                tello_center.FpsRecoder.key(tello_abs.MyTello.KEY_VIDEO_FPS):
                False,
                tello_center.FpsRecoder.key(tello_abs.MyTello.KEY_STATE_FPS):
                False,
                tello_center.FpsRecoder.key(ImageProcessService.KEY_FPS):
                False
            }))

    tello_center.register_service(
        tello_center.PreLoadService(tasks=[ImageProcessService.preload]))
    tello_center.register_service(tello_abs.TelloBackendService())  # 提供基础控制和数据
    tello_center.register_service(tello_abs.ReactiveImageAndStateService())
    tello_center.register_service(
        ImageProcessService(
            handlers=[ProxyImageHandler(FireDetector)]))  # 提供图片处理
Exemple #6
0
        @param chest_idx:
        @param obj_name:
        @return: CODE_ERROR_TARGET = 0, CODE_CONTINUE = 1, CODE_TASK_DONE = 2
        """
        if self.targets is None:
            self.targets = self.server.get_targets()
            for i in range(len(self.targets)):
                self.targets_idx[self.targets[i]] = i + 1

        self.chest_info[chest_idx].obj_name = obj_name
        return self.update_chest_info()


if __name__ == '__main__':
    logger = sl4p.Sl4p('__main__')
    tello_center.register_service(tello_center.ConfigService(config={}))
    tello_center.register_service(JudgeClientService())
    tello_center.register_service(JudgeServerLocal())
    tello_center.start_all_service()

    client = tello_center.service_proxy_by_class(
        JudgeClientService)  # type: JudgeClientService

    client.server.takeoff()
    client.server.seen_fire()
    logger.info(code2name[client.put_chest_info(1, NAME_BABY)])
    logger.info(code2name[client.put_chest_info(3, NAME_CAT)])
    logger.info(code2name[client.put_chest_info(2, NAME_GAS_TANK)])
    logger.info(code2name[client.put_chest_info(4, NAME_FILES)])
    logger.info(code2name[client.put_chest_info(5, NAME_PAINTING)])