def homing(): print "running boustro" #if params["notif"]["port"]: sendNotif("ON", params["notif"]["port"]) s = cnc.init(True) s.close() #if params["notif"]["port"]: sendNotif("OFF", params["notif"]["port"]) return "ok"
def clean(): s = cnc.init(False) path = np.load("data/tool_path.npy") cnc.run_path(path[0], path[1], params["calib"]["x0"], params["calib"]["y0"], params["calib"]["scale"], params["tool"]["feed_rate"], params["tool"]["z"], params["tool"]["rotspeed"], s) cnc.send_cmd("G0 x0 y0 \n", s) s.close() return "ok"
def boustro(): print "running boustro" #if params["notif"]["port"]: sendNotif("ON", params["notif"]["port"]) s = cnc.init(False) path = np.load("data/boustro.npy") print path.shape cnc.run_path(path[0], path[1], params["calib"]["x0"], params["calib"]["y0"], params["calib"]["scale"], params["tool"]["feed_rate"], params["tool"]["z"], params["tool"]["rotspeed"], s, False) cnc.send_cmd("G0 x0 y0 \n", s) s.close() #if params["notif"]["port"]: sendNotif("OFF", params["notif"]["port"]) print '...' return "ok"
import cnc_utils as cnc import time import json import cv2 import numpy as np import serial import urllib import lettucehoe2 as lh import workspace as ws import plot_utils as pu import os params = json.load(open("params/params.json", "r")) app = Flask(__name__) s = [] s = cnc.init(False) def grab_url(url): req = urllib.urlopen(url) arr = np.asarray(bytearray(req.read()), dtype=np.uint8) img = cv2.imdecode(arr, -1) return img def topcam_pic(imdir, s): cnc.send_cmd("G0 y500 \n", s) cnc.send_cmd("G4 P1 \n", s) im = ut.grab_url('/lettucesee/raspicam/?action=snapshot') cv2.imwrite(imdir + "topcam.jpg", im) cnc.send_cmd("G0 y0 \n", s)
from flask import Flask, request, jsonify, render_template, abort from flask import redirect, url_for, send_file import time import serial import json import numpy as np import cnc_utils as cu import bracket_utils as bu import depthsense_utils as DSu params = json.load(open("params/default.json", 'r')) #app = Flask(__name__, template_folder=params["tempdir"]) app = Flask(__name__) ds = DSu.DS.initDepthSense() s_cnc = cu.init() s_bracket = bu.init() @app.route('/') def index(): return redirect('static/index.html') @app.route('/moveto', methods=['POST']) def updatePose(): pose = [] for coord in ['x', 'y', 'z', 'pan', 'tilt']: pos.append( cu.clamped(request.form[coord], params['lims'][coord], params['scale'][coord])) cu.send_cmd("g0x%sy%sz-%s" % (pose[0], pos[1], pos[2]), s_cnc)