Loop your Farmbot by plants with filters, or by automatic waypoint calculation to cover plant search results grid area.
Originally forked from Loop-Plants-With-Filters, thank you @rdegosse!
Fig. P30: PowerLoop taking a Selfie of my Farmbot garden, automatically choosing steps where the photos includes plants (with their radius), excluding empty shots
Go to My Farmbot -> Farmware, then paste the manifest.json path to install:
https://raw.githubusercontent.com/amerkay/powerloop/master/manifest_v2.json
Please report bugs using the issues tab.
Go to My Farmbot -> Farmware, then paste the manifest.json path to install:
https://raw.githubusercontent.com/amerkay/powerloop/master/manifest.json
I tried to add as much comments and documentation within the files, as well as clear variable and method naming. If you want to use one of the files in your own project, I made sure they are as self-contained and documented as possible. Please use freely. Pull requests appreciated - even if it takes me time to get to it.
-
Load all plants for current device from Farmbot API.
-
Filter plants by plant name, Openfarm slug, age in day range. meta data key/value, and coordinates. See manifest.json.
-
Sort resulting plants or Grid waypoints using simple sort(x, y), or using Travelling Salesman Greedy Algorithm by setting 'Use Travelling Salesman Problem Greedy algorithm' to 'True'.
-
Calculate grid coverage waypoints, using (optionally filtered) plant list as input. This is useful when you want to scan your garden with multiple photos or run the deweeding algorithm. See examples section.
-
Execute list of sequences (initial, before each move, after each move, end).
-
Offset X and Offset Y for each move. Can be set to
randint(i,j)
to randomize the X Y offset. One use case is for repetitive tasks like watering seedlings that you don't want to harm with the water pressure, e.g set offsetrandint(-20,20)
to randomize movement by +/- 2cm. -
Loop all filtered plants
- Move to plant coordinate (X, Y) with offset X, offset Y, default Z and default speed
- Save meta data key/value, if set
- Save plant_stage value, if set
- Runs before and after list of sequences, if set
-
Uses official farmware_tools to contact Farmbot API and control device.
-
Uses concurrent task executor to save meta data to API, to save time executing each move. More about concurrent.futures.ProcessPoolExecutor at Python docs.
See manifest.json, includes extra "help" key with more information.
Example 1: Automatic Farmbot Garden Selfie
Automate taking photos/weed detecion of your plants with the least number of waypoints to visit. You can run it in two different modes: basic and summary. Tutorial here.
Fig. ST0: Selfie with coverage area=(400,400), grid_coverage_summarize = False, and overlap=0. Python test file output with matplotlib. See /test/ directory
Fig. ST30: Selfie with coverage area=(400,400), grid_coverage_summarize = True, and overlap=30. Python test file output with matplotlib. See /test/ directory
Example 2: Water all Farmbot plants using 'Water Doser' farmware
"Water Doser" farmware automatically calculate how many seconds to water each plant individually based on it's age and maximum spread from OpenFarm data. Can be run independantly, as it guesses which plant the farmbot is on top of automatically if configured correctly. Alternatively, you can have your own watering sequence. Tutorial here
Fig. TSP: Travelling Salesman Solution for moving between the resulting filtered list of plants (default behavior)
- Calibrating Farmbot Camera for precision, with an example on how to setup to shoot weeds with the water output (without the watering tool).