예제 #1
0
파일: main.py 프로젝트: amerkay/powerloop
        input_store = InputStore(FARMWARE_NAME, defaults=INPUT_DEFAULTS)
        # set logger level
        Logger.set_level(input_store.input["debug"])

        # create SequenceExecutor instance
        sexec = SequenceExecutor(FARMWARE_NAME, input_store.input)

        log(
            "Started with python version {}".format(sys.version_info),
            message_type="info",
            title="init",
        )

        # create Plants class instance
        plants = Plants(FARMWARE_NAME, input_store.input)
        grid_points = GridPoints(FARMWARE_NAME, input_store.input)

        # Start a concurrent task executor, with pool size 4
        # Example at doc @ https://docs.python.org/3/library/concurrent.futures.html
        executor = concurrent.futures.ProcessPoolExecutor(max_workers=4)

        # load the plants
        points_plants = plants.load_points_with_filters()

        # Use plants loaded to choose grid waypoints, if overlap < 20, use basic waypoints
        if input_store.input["grid_coverage_summarize"] is True:
            waypoints = grid_points.calc_waypoints_summary(points_plants)
        else:
            waypoints = grid_points.calc_waypoints_basic(points_plants)

        def run_after_each(p):
예제 #2
0
        Logger.set_level(3)

        log(
            "Started with python version {}".format(sys.version_info),
            message_type="info",
            title="init",
        )

        # Load fake plants
        points_plants = FakePlants.get_fake_plants()

        # init instance of GridPoints
        grid_points = GridPoints(
            FARMWARE_NAME,
            config={
                "grid_coverage_per_step": cover,
                "grid_coverage_offset": offset,
                "grid_coverage_overlap": overlap,
            },
        )

        # points_grid = grid_points.calc_waypoints_basic(points_plants)
        # Use plants loaded to choose grid waypoints, if overlap = 0, use basic waypoints
        if overlap >= 30:
            waypoints = grid_points.calc_waypoints_summary(points_plants)
        else:
            waypoints = grid_points.calc_waypoints_basic(points_plants)

        points = waypoints if waypoints else points_plants

        # ------------- plot plants ----------------
        fig = plt.figure()