コード例 #1
0
ファイル: script.py プロジェクト: MakotoNinja/test-bed
#!/usr/bin/env python

'''
 ' A farmware for a custom tool for Farmbot
'''

import os, sys, json, Qualify
from random import randint
from farmware_tools import device, app, get_config_value
from Coordinate import Coordinate

PIN_LIGHTS = 7
PKG = 'Test Bed'

input_errors = []
integer = Qualify.integer(PKG, 'integer')

tools = app.get_toolslots()
device.log(json.dumps(tools))

tool = Qualify.get_tool(4469)
device.log(json.dumps(tool))

plants = app.get_plants()
device.log(json.dumps(plants))

device.write_pin(PIN_LIGHTS, 0, 0)
コード例 #2
0
    types = ['weed', 'safe-remove weed'
             ] if WEED_TYPE == 'both' else [WEED_TYPE]
    device.log('Weed Type(s): {}'.format(json.dumps(types)))
    wp = []
    for point in points:
        if point['name'].lower() in types:
            wp.append(point)
    return wp


PIN_LIGHTS = 7
PIN_WATER = 8
PIN_ZAPPER = 10
PKG = 'Weed Zapper'

X_START = Qualify.integer(PKG, 'x_start')
Y_START = Qualify.integer(PKG, 'y_start')
X_MAX = Qualify.integer(PKG, 'x_max')
Y_MAX = Qualify.integer(PKG, 'y_max')
ZAP_HEIGHT = Qualify.integer(PKG, 'zap_height')
ZAP_SPEED = Qualify.integer(PKG, 'zap_speed')
ZAP_TIMEOUT = Qualify.integer(PKG, 'zap_timeout')
Z_TRANSLATE = Qualify.integer(PKG, 'z_translate')
X_MOVE = Qualify.integer(PKG, 'x_move')
Y_MOVE = Qualify.integer(PKG, 'y_move')
AREA_SIZE = Qualify.integer(PKG, 'area_size')
LASER_OFFSET_X = Qualify.integer(PKG, 'offset_x')
LASER_OFFSET_Y = Qualify.integer(PKG, 'offset_y')

WEED_TYPE = get_config_value(PKG, 'weed_type', str).lower()
if WEED_TYPE not in ['weed', 'safe-remove', 'both']:
コード例 #3
0
ファイル: script.py プロジェクト: MakotoNinja/water-plants
#!/usr/bin/env python
'''
 ' A plant watering Farmware
'''

import os, sys, json, Qualify
from random import randint
from farmware_tools import device, app, get_config_value
from Coordinate import Coordinate

PIN_LIGHTS = 7
PKG = 'Water Plants'

PLANT_TYPES = Qualify.get_csv(PKG, 'plant_types')
TRANSLATE_HMEIGHT = Qualify.integer(PKG, 'translate_height')
WATER_HEIGHT = Qualify.integer(PKG, 'water_height')

tool_water_retrieve_sequence_id = Qualify.sequence(PKG, 'tool_water_retrieve')
tool_water_return_sequence_id = Qualify.sequence(PKG, 'tool_water_return')

if len(Qualify.errors):
    for err in Qualify.errors:
        device.log(err, 'error', ['toast'])
    sys.exit()
else:
    device.log('No config errors detected')

device.log('PLANT TYPES: {}'.format(json.dumps(PLANT_TYPES)))
all_plants = app.get_plants()
target_plants = []
for plant in all_plants:
コード例 #4
0
        device.execute(water_tool_return_sequence_id)


Debug.debug_flag = True
PIN_LIGHTS = 7
PIN_SENSOR = 59
PIN_WATER = 8
PKG = 'Water Routine'

device.log('INIT: {}'.format(PKG))
Debug.log('BEGIN FARMWARE: {}'.format(PKG))

input_errors = []
PLANT_TYPES = Qualify.get_csv(PKG, 'plant_types')
Debug.log('PLANT TYPES: {}'.format(PLANT_TYPES))
SENSOR_Z_DEPTH = Qualify.integer(PKG, 'sensor_z_depth')
Z_TRANSLATE = Qualify.integer(PKG, 'z_translate')
OFFSET_X = Qualify.integer(PKG, 'offset_x')
OFFSET_Y = Qualify.integer(PKG, 'offset_y')
THRESHOLD = Qualify.integer(PKG, 'threshold')
NUM_SITES = Qualify.integer(PKG, 'num_sites')
NUM_SAMPLES = Qualify.integer(PKG, 'num_samples')

moisture_tool_retrieve_sequence_id = Qualify.sequence(
    PKG, 'tool_moisture_retrieve')
moisture_tool_return_sequence_id = Qualify.sequence(PKG,
                                                    'tool_moisture_return')
water_tool_retrieve_sequence_id = Qualify.sequence(PKG, 'tool_water_retrieve')
water_tool_return_sequence_id = Qualify.sequence(PKG, 'tool_water_return')
water_sequence_id = Qualify.sequence(PKG, 'water_sequence')