class ChipStage(object): def __init__(self, ser_list): self.stepsize = 10 # To bring the dist_measurement to valid start point # can be left at zero with wide enough chip holders self.width_off = 0 #3.5 # 2.5 self.length_off = 4 #1.0 # 1.5 #Calibration for Chip Leveling for X-Axis self.x_coordX = 0 self.y_coordX = 3.5 #Calibration for Chip Leveling for Y-Axis self.x_coordY = 8.5 self.y_coordY = 1 def r_init(): self.rot = Rotator(ser_list[0]) def gl_init(): self.gon_l = GonStage(ser_list[1], 'GNL10') def gr_init(): self.gon_r = GonStage(ser_list[2], 'GNL18') t_r = threading.Thread(target=r_init) #t_gl = threading.Thread(target=gl_init) #t_gr = threading.Thread(target=gr_init) t_r.start() #, t_gl.start(), t_gr.start() t_r.join() #, t_gl.join(), t_gr.join() def set_stepsize(self, stepsize): ''' Updates the degree stepsize used in step() function ''' self.stepsize = stepsize def step(self, direction): ''' - Move Stage in either direction by one step - Step Size defined in set_stepsize() - direction expected to be char: L(CW),R(CCW) ''' if self.rot.moving == False: if direction == 'L': self.rot.delta_angle(self.stepsize) self.angle = self.rot.deg_pos if direction == 'R': self.rot.delta_angle(-self.stepsize) self.angle = self.rot.deg_pos
def run(self): self.__loadConfigs() self.player = pyaudio.PyAudio() # hacky solution, but in this way the console will only print the error once for ii in range(self.player.get_device_count()): self.player.get_device_info_by_index(ii) self.__dailTone = Sound(self.player, './music/kiestoon.wav') self.__dailTone.repeat = True self.rotator = Rotator( self.config.get('DialerRedGpio', self.DAILER_STEP_PIN_DEFAULT), self.config.get('DialerYellowGpio', self.DAILER_ISON_PIN_DEFAULT) ) self.rotator.when_dailed = self.dailed self.hook = gpiozero.Button(self.config.get('HookGpio', self.HOOK_PIN_DEFAULT)) self.hook.when_released = self.offHook self.hook.when_pressed = self.onHook print('t65 started') if not self.hook.is_pressed: # start offHook when it's already of the hook self.offHook() self.__mainLoop()
def can_rotate(self, field, direction): next_rotation = self.rotation.apply(direction) rotated = Rotator(self.mino_type.value, next_rotation).rotate() if self.__is_collision(field, Blocks(rotated), self.position): return False else: return True
def __init__(self) -> None: self.qr_detector = cv2.QRCodeDetector() self.east = cv2.dnn.readNet( self.EAST_DETECTOR) # load the pre-trained EAST text detector self.rotator = Rotator(self.ROTATOR) list_of_words_for_ocr = [] drug_list = [] drug_list_processed = [] with open(self.DRUG_LIST_FILE) as drug_list_f: drug_list = drug_list_f.readlines() for drug in drug_list: drug_list_processed.append( list(filter(lambda x: len(x) > 2, drug.lower().split()))) list_of_words_for_ocr += drug.lower().split() list_of_words_for_ocr.append(drug) ean_to_drugs_dict = {} with open(self.EAN_TO_DRUG_LIST_FILE) as drug_list_f: ean_to_drugs_list = drug_list_f.readlines() for ean_to_drug in ean_to_drugs_list: ean, drug = ean_to_drug.split(" ", 1) ean_to_drugs_dict[ean] = drug sukl_to_drugs_dict = {} with open(self.SUKL_FILE) as sukl_f: reader = csv.DictReader(sukl_f) for row in reader: sukl, name, ean = row["sukl_code"], row["name"], row[ "ean_code"] pure_name = self.__until_first_lower_case(name) drug_list.append(name) drug_list_processed.append( list( filter(lambda x: len(x) > 2, pure_name.lower().split()))) ean_to_drugs_dict[ean] = name sukl_to_drugs_dict[sukl] = name list_of_words_for_ocr += [pure_name, name] + name.split() self.drug_list = drug_list # List of drugs full names self.drug_list_processed = drug_list_processed # List of drug names splitted in lowercase without generic fluff (potahované tablety, ...), only words longer than 2 self.ean_to_drugs_dict = ean_to_drugs_dict # EAN to full name self.sukl_to_drugs_dict = sukl_to_drugs_dict # SUKL to full name with open(self.OCR_DICT, "w") as f_ocr_dict: f_ocr_dict.writelines( map(lambda x: x + "\n", list_of_words_for_ocr))
def __connect_hotkeys(self, root): r = root r.bind("<Key-a>", lambda ev: self.__add_mark_and_select_it()) r.bind("<Prior>", lambda ev: self.__choose_prev_mark()) r.bind("<Next>", lambda ev: self.__choose_next_mark()) r.bind("<Delete>", lambda ev: self.__remove_mark()) self.__mover = Mover(root, self.__move_mark) self.__rotator = Rotator(root, self.__rotate_mark) r.bind("<Control-Left>", lambda ev: self.__change_width(-self.__W_C)) r.bind("<Control-Right>", lambda ev: self.__change_width(self.__W_C)) r.bind("<Control-Up>", lambda ev: self.__change_length(self.__L_C)) r.bind("<Control-Down>", lambda ev: self.__change_length(-self.__L_C))
#!/usr/bin/env python3 """ CLI for zeroing the rotator. Intended for testing and setup uses. author: Marion Anderson date: 2018-07-28 file: zero.py """ from __future__ import absolute_import, print_function from rotator import Rotator # Rotator setup rot = Rotator() rot.attach(23, 17, 22) # from my soldershield design rot.zero() # zero before doing anything
def __update_ceched_blocks(self): rotated = Rotator(self.mino_type.value, self.rotation).rotate() self.blocks = Blocks(rotated)
def bGeneratePressed(self, _): self.bSave.Enable(False) self.bVisualize.Enable(False) self.gcl.clear() self.gcode = [] errs = [] try: dec = int(self.teDecimals.GetValue()) self.fmt = "%0." + str(dec) + "f" except: errs.append("Decimal Places") try: sx = float(self.teStartX.GetValue()) except: errs.append("Start X") try: sy = float(self.teStartY.GetValue()) except: errs.append("Start Y") try: sz = float(self.teStartZ.GetValue()) except: errs.append("Start Z") try: safez = float(self.teSafeZ.GetValue()) except: errs.append("Safe Z") addspeed = self.cbAddSpeed.IsChecked() try: feedzG0 = float(self.teFeedZG0.GetValue()) except: errs.append("Z G0 Speed") try: feedzG1 = float(self.teFeedZG1.GetValue()) except: errs.append("Z G1 Speed") try: feedxyG0 = float(self.teFeedXYG0.GetValue()) except: errs.append("XY G0 Speed") try: feedxyG1 = float(self.teFeedXYG1.GetValue()) except: errs.append("XY G1 Speed") try: height = float(self.teHeight.GetValue()) except: errs.append("Height") try: width = float(self.teWidth.GetValue()) except: errs.append("Width") try: depth = float(self.teTotalDepth.GetValue()) except: errs.append("Depth") try: passdepth = float(self.tePassDepth.GetValue()) except: errs.append("Depth per Pass") try: tdiam = float(self.teToolDiam.GetValue()) except: errs.append("Tool Diameter") try: stepover = float(self.teStepOver.GetValue()) except: errs.append("Stepover") try: angle = float(self.teAngle.GetValue()) except: errs.append("Angle") if not ValidateNoEntryErrors(self, errs): return rot = Rotator(angle) if not ValidateToolSize(self, tdiam, height, "Height"): return if not ValidateToolSize(self, tdiam, width, "Width"): return if not ValidateRange(self, stepover, 0.001, 1.0, "Stepover", "0 < x <= 1.0"): return self.gcode = self.preamble(self.getChosen(self.rbMeas), tdiam, self.toolInfo, safez) self.tDiam = tdiam if self.settings.annotate: if angle == 0: self.gcode.append( "(Rectangle (%6.2f,%6.2f) to (%6.2f,%6.2f) depth from %6.2f to %6.2f)" % (sx, sy, width, height, sz, depth)) else: rx1, ry1 = rot.rotate(sx, sy) rx2, ry2 = rot.rotate(width + sx, height + sy) self.gcode.append( "(Rectangle (%6.2f,%6.2f) to (%6.2f,%6.2f) depth from %6.2f to %6.2f rotated %6.2f)" % (rx1, ry1, rx2, ry2, sz, depth, angle)) points = [[sx, sy], [sx, sy + height], [sx + width, sy + height], [sx + width, sy], [sx, sy]] sp = self.getChosen(self.rbStartPoints) adjx = 0 adjy = 0 if sp == "Upper Left": adjy = -height elif sp == "Upper Right": adjy = -height adjx = -width elif sp == "Lower Right": adjx = -width elif sp == "Center": adjx = -width / 2 adjy = -height / 2 for p in points: p[0] += adjx p[1] += adjy tm = self.getChosen(self.rbToolMove) rad = float(tdiam) / 2.0 if tm == "Inside Rectangle": points[0][0] += rad points[0][1] += rad points[1][0] += rad points[1][1] -= rad points[2][0] -= rad points[2][1] -= rad points[3][0] -= rad points[3][1] += rad points[4][0] += rad points[4][1] += rad elif tm == "Outside Rectangle": points[0][0] -= rad points[0][1] -= rad points[1][0] -= rad points[1][1] += rad points[2][0] += rad points[2][1] += rad points[3][0] += rad points[3][1] -= rad points[4][0] -= rad points[4][1] -= rad cd = self.getChosen(self.rbCutDir) if cd != "Clockwise": np = points[::-1] points = np pkt = self.getChosen(self.rbPkts) if self.settings.annotate: self.gcode.append("(Start point: %s)" % sp) self.gcode.append("(Cutting direction: %s)" % cd) self.gcode.append("(Tool movement: %s)" % tm) self.gcode.append("(Pocket: %s)" % pkt) if pkt == "None": self.gcode.append( ("G0 Z" + self.fmt + self.speedTerm(addspeed, feedzG0)) % (safez)) self.gcode.append(("G0 X" + self.fmt + " Y" + self.fmt + self.speedTerm(addspeed, feedxyG0)) % rot.rotate(points[0][0], points[0][1])) xmin = min(points[0][0], points[2][0]) + tdiam / 2 xmax = max(points[0][0], points[2][0]) - tdiam / 2 ymin = min(points[0][1], points[2][1]) + tdiam / 2 ymax = max(points[0][1], points[2][1]) - tdiam / 2 passes = int(math.ceil(depth / passdepth)) cz = sz xlast = 0 ylast = 0 for i in range(passes): cz -= passdepth if cz < -depth: cz = -depth if self.settings.annotate: self.gcode.append("(Pass number %d at depth %f)" % (i, cz)) if pkt == "Horizontal": first = True alt = True y = ymin self.gcode.append( ("G0 Z" + self.fmt + self.speedTerm(addspeed, feedzG0)) % (safez)) self.gcode.append(("G0 X" + self.fmt + " Y" + self.fmt + self.speedTerm(addspeed, feedxyG0)) % rot.rotate(xmin, ymin)) self.gcode.append( ("G1 Z" + self.fmt + self.speedTerm(addspeed, feedzG1)) % (cz)) while y <= ymax: if not first: self.gcode.append( ("G1 X" + self.fmt + " Y" + self.fmt + self.speedTerm(addspeed, feedxyG1)) % rot.rotate(xlast, y)) if alt: self.gcode.append( ("G1 X" + self.fmt + " Y" + self.fmt + self.speedTerm(addspeed, feedxyG1)) % rot.rotate(xmax, y)) xlast = xmax else: self.gcode.append( ("G1 X" + self.fmt + " Y" + self.fmt + self.speedTerm(addspeed, feedxyG1)) % rot.rotate(xmin, y)) xlast = xmin y += tdiam * stepover first = False alt = not alt self.gcode.append( ("G0 Z" + self.fmt + self.speedTerm(addspeed, feedzG0)) % (safez)) self.gcode.append(("G0 X" + self.fmt + " Y" + self.fmt + self.speedTerm(addspeed, feedxyG0)) % rot.rotate(points[0][0], points[0][1])) elif pkt == "Vertical": first = True alt = True x = xmin self.gcode.append( ("G0 Z" + self.fmt + self.speedTerm(addspeed, feedzG0)) % (safez)) self.gcode.append(("G0 X" + self.fmt + " Y" + self.fmt + self.speedTerm(addspeed, feedxyG0)) % rot.rotate(xmin, ymin)) self.gcode.append( ("G1 Z" + self.fmt + self.speedTerm(addspeed, feedzG1)) % (cz)) while x <= xmax: if not first: self.gcode.append( ("G1 X" + self.fmt + " Y" + self.fmt + self.speedTerm(addspeed, feedxyG1)) % rot.rotate(x, ylast)) if alt: self.gcode.append( ("G1 X" + self.fmt + " Y" + self.fmt + self.speedTerm(addspeed, feedxyG1)) % rot.rotate(x, ymax)) ylast = ymax else: self.gcode.append( ("G1 X" + self.fmt + " Y" + self.fmt + self.speedTerm(addspeed, feedxyG1)) % rot.rotate(x, ymin)) ylast = ymin x += tdiam * stepover first = False alt = not alt self.gcode.append( ("G0 Z" + self.fmt + self.speedTerm(addspeed, feedzG0)) % (safez)) self.gcode.append(("G0 X" + self.fmt + " Y" + self.fmt + self.speedTerm(addspeed, feedxyG0)) % rot.rotate(points[0][0], points[0][1])) elif pkt == "Centered": vertical = False if (xmax - xmin) > (ymax - ymin): ya = (ymax + ymin) / 2.0 yb = ya d = ymax - ya xa = xmin + d xb = xmax - d elif (xmax - xmin) < (ymax - ymin): vertical = True xa = (xmax + xmin) / 2.0 xb = xa d = xmax - xa ya = ymin + d yb = ymax - d else: xa = (xmax + xmin) / 2.0 xb = xa ya = (ymax + ymin) / 2.0 yb = ya self.gcode.append( ("G0 Z" + self.fmt + self.speedTerm(addspeed, feedzG0)) % (safez)) self.gcode.append( ("G0 X" + self.fmt + " Y" + self.fmt + self.speedTerm(addspeed, feedxyG0)) % rot.rotate(xb, yb)) self.gcode.append( ("G1 Z" + self.fmt + self.speedTerm(addspeed, feedzG1)) % (cz)) self.gcode.append( ("G1 X" + self.fmt + " Y" + self.fmt + self.speedTerm(addspeed, feedxyG1)) % rot.rotate(xa, ya)) d = stepover * tdiam while (xa - d) >= xmin: if cd == "Clockwise": self.gcode.append( ("G1 X" + self.fmt + " Y" + self.fmt + self.speedTerm(addspeed, feedxyG1)) % rot.rotate(xa - d, ya - d)) if vertical: self.gcode.append( ("G1 X" + self.fmt + " Y" + self.fmt + self.speedTerm(addspeed, feedxyG1)) % rot.rotate(xa - d, yb + d)) else: self.gcode.append( ("G1 X" + self.fmt + " Y" + self.fmt + self.speedTerm(addspeed, feedxyG1)) % rot.rotate(xa - d, ya + d)) self.gcode.append( ("G1 X" + self.fmt + " Y" + self.fmt + self.speedTerm(addspeed, feedxyG1)) % rot.rotate(xb + d, yb + d)) if vertical: self.gcode.append( ("G1 X" + self.fmt + " Y" + self.fmt + self.speedTerm(addspeed, feedxyG1)) % rot.rotate(xb + d, ya - d)) else: self.gcode.append( ("G1 X" + self.fmt + " Y" + self.fmt + self.speedTerm(addspeed, feedxyG1)) % rot.rotate(xb + d, yb - d)) self.gcode.append( ("G1 X" + self.fmt + " Y" + self.fmt + self.speedTerm(addspeed, feedxyG1)) % rot.rotate(xa - d, ya - d)) else: self.gcode.append( ("G1 X" + self.fmt + " Y" + self.fmt + self.speedTerm(addspeed, feedxyG1)) % rot.rotate(xa - d, ya - d)) if vertical: self.gcode.append( ("G1 X" + self.fmt + " Y" + self.fmt + self.speedTerm(addspeed, feedxyG1)) % rot.rotate(xb + d, ya - d)) else: self.gcode.append( ("G1 X" + self.fmt + " Y" + self.fmt + self.speedTerm(addspeed, feedxyG1)) % rot.rotate(xb + d, yb - d)) self.gcode.append( ("G1 X" + self.fmt + " Y" + self.fmt + self.speedTerm(addspeed, feedxyG1)) % rot.rotate(xb + d, yb + d)) if vertical: self.gcode.append( ("G1 X" + self.fmt + " Y" + self.fmt + self.speedTerm(addspeed, feedxyG1)) % rot.rotate(xa - d, yb + d)) else: self.gcode.append( ("G1 X" + self.fmt + " Y" + self.fmt + self.speedTerm(addspeed, feedxyG1)) % rot.rotate(xa - d, ya + d)) self.gcode.append( ("G1 X" + self.fmt + " Y" + self.fmt + self.speedTerm(addspeed, feedxyG1)) % rot.rotate(xa - d, ya - d)) d += stepover * tdiam self.gcode.append( ("G0 Z" + self.fmt + self.speedTerm(addspeed, feedzG0)) % (safez)) self.gcode.append(("G0 X" + self.fmt + " Y" + self.fmt + self.speedTerm(addspeed, feedxyG0)) % rot.rotate(points[0][0], points[0][1])) self.gcode.append( ("G1 Z" + self.fmt + self.speedTerm(addspeed, feedzG1)) % (cz)) for p in points[1:]: self.gcode.append(("G1 X" + self.fmt + " Y" + self.fmt + self.speedTerm(addspeed, feedxyG1)) % rot.rotate(p[0], p[1])) self.gcode.append( ("G0 Z" + self.fmt + self.speedTerm(addspeed, feedzG0)) % (safez)) if self.settings.annotate: self.gcode.append("(End object %s)" % self.viewTitle) self.gcl.updateList(self.gcode) self.bSave.Enable() self.bVisualize.Enable() self.setState(False, True)
def r_init(): self.rot = Rotator(ser_list[0])
from rotator import Rotator import time import requests from flask import request from envs.config import rotation_step from stream.config import INPUT_WIDTH, INPUT_HEIGHT from camera import PiCam SERVER_URL = "http://192.168.0.47:5000/action" rotator = Rotator() cam = PiCam(INPUT_WIDTH, INPUT_HEIGHT) def get_action(frame): data = frame.tostring() response = requests.post(SERVER_URL, data=data).json() return response['action'] def get_rotation(curr_angle, action): if action == '1': step = rotation_step elif action == '2': step = -rotation_step else: step = 0 new_angle = curr_angle + step return new_angle
def bGeneratePressed(self, _): self.bVisualize.Enable(False) self.bSave.Enable(False) self.gcl.clear() self.gcode = [] errs = [] try: dec = int(self.teDecimals.GetValue()) self.fmt = "%0." + str(dec) + "f" except: errs.append("Decimal Places") try: sx = float(self.teStartX.GetValue()) except: errs.append("Start X") try: sy = float(self.teStartY.GetValue()) except: errs.append("Start Y") try: sz = float(self.teStartZ.GetValue()) except: errs.append("Start Z") try: angle = float(self.teAngle.GetValue()) except: errs.append("Angle") try: safez = float(self.teSafeZ.GetValue()) except: errs.append("Safe Z") addspeed = self.cbAddSpeed.IsChecked() try: feedzG0 = float(self.teFeedZG0.GetValue()) except: errs.append("Z G0 Speed") try: feedzG1 = float(self.teFeedZG1.GetValue()) except: errs.append("Z G1 Speed") try: feedxyG0 = float(self.teFeedXYG0.GetValue()) except: errs.append("XY G0 Speed") try: feedxyG23 = float(self.teFeedXYG1.GetValue()) except: errs.append("XY G1 Speed") try: height = float(self.teHeight.GetValue()) except: errs.append("Height") try: width = float(self.teWidth.GetValue()) except: errs.append("Width") try: depth = float(self.teDepth.GetValue()) except: errs.append("Depth") try: passdepth = float(self.tePassDepth.GetValue()) except: errs.append("Depth per Pass") try: stepover = float(self.teStepover.GetValue()) except: errs.append("Stepover") try: tdiam = float(self.teToolDiam.GetValue()) except: errs.append("Tool Diameter") try: hdiam = float(self.teHoleDiam.GetValue()) except: errs.append("Hole Diameter") try: spacing = float(self.teSpacing.GetValue()) except: errs.append("Spacing") if not ValidateNoEntryErrors(self, errs): return if not ValidateToolSize(self, tdiam, hdiam, "Hole Diameter"): return if not ValidateMinLength(self, height, hdiam + spacing, "Height", "Hole Diameter + Spacing"): return if not ValidateMinLength(self, width, hdiam + spacing, "Width", "Hole Diameter + Spacing"): return self.gcode = self.preamble(self.getChosen(self.rbMeas), tdiam, self.toolInfo, safez) sp = self.getChosen(self.rbStartPoints) if sp == "Upper Left": sy -= height elif sp == "Upper Right": sy -= height sx -= width elif sp == "Lower Right": sx -= width elif sp == "Center": sx -= width / 2 sy -= height / 2 perimeteronly = self.cbPerimeter.IsChecked() inside = self.cbInside.IsChecked() if perimeteronly: stagger = False else: stagger = self.cbStagger.IsChecked() retract = self.cbRetract.IsChecked() if inside: minx = sx + hdiam / 2 maxx = sx + width - hdiam / 2 miny = sy + hdiam / 2 maxy = sy + height - hdiam / 2 else: minx = sx maxx = sx + width miny = sy maxy = sy + height cd = self.getChosen(self.rbCutDir) if cd == "Clockwise": cmd = "G2" else: cmd = "G3" nrows = int((maxy - miny) / (hdiam + spacing)) ncols = int((maxx - minx) / (hdiam + spacing)) xstep = (maxx - minx) / float(ncols) ystep = (maxy - miny) / float(nrows) if stagger: ystep *= 0.866 nrows = int((nrows / 0.866) + 0.5) cx = minx cy = miny rot = None if angle != 0: rot = Rotator(angle) if self.settings.annotate: self.gcode.append( "(Rectangular drill pattern start (%6.2f,%6.2f) height %6.2f width %6.2f depth from %6.2f to %6.2f)" % (sx, sy, height, width, sz, depth)) self.gcode.append("(Starting point: %s)" % sp) self.gcode.append("(Cut Direction: %s)" % cd) self.gcode.append("(Inside Circle: %s)" % str(inside)) self.gcode.append("(Perimeter Only: %s)" % str(perimeteronly)) self.gcode.append("(Retract each pass: %s)" % str(retract)) self.gcode.append("(Hole diameter: %6.2f)" % hdiam) self.gcode.append("(Stagger rows: %s)" % str(stagger)) self.gcode.append("(Calculated step x/y: %6.2f/%6.2f)" % (xstep, ystep)) self.gcode.append( ("G0 Z" + self.fmt + self.speedTerm(addspeed, feedzG0)) % (safez)) passes = int(math.ceil(depth / passdepth)) maxyoff = hdiam / 2 - tdiam / 2 for iy in range(nrows + 1): for ix in range(ncols + 1): includeHole = False if not perimeteronly: if cx <= maxx and cy <= maxy: includeHole = True else: if ix == 0 or ix == ncols or iy == 0 or iy == nrows: includeHole = True if includeHole: if rot is None: nx = cx ny = cy else: nx, ny = rot.rotate(cx, cy) self.gcode.append( ("G0 X" + self.fmt + " Y" + self.fmt + self.speedTerm(addspeed, feedxyG0)) % (nx, ny)) cz = sz for i in range(passes): cz -= passdepth if cz < -depth: cz = -depth if self.settings.annotate: self.gcode.append("(Pass number %d at depth %f)" % (i, cz)) self.gcode.append( ("G1 Z" + self.fmt + self.speedTerm(addspeed, feedzG1)) % (cz)) if hdiam > tdiam: maxyoff = (hdiam - tdiam) / 2.0 yoff = stepover while True: if yoff > maxyoff: yoff = maxyoff self.gcode.append( ("G1 Y" + self.fmt + self.speedTerm(addspeed, feedxyG0)) % (ny - yoff)) self.gcode.append( (cmd + " J" + self.fmt + " X" + self.fmt + " Y" + self.fmt + self.speedTerm(addspeed, feedxyG23)) % (yoff, nx, ny - yoff)) if yoff >= maxyoff: break yoff += stepover self.gcode.append( ("G1 X" + self.fmt + " Y" + self.fmt + self.speedTerm(addspeed, feedxyG23)) % (nx, ny)) if retract: self.gcode.append( ("G0 Z" + self.fmt + self.speedTerm(addspeed, feedzG0)) % (safez)) if not retract: self.gcode.append( ("G0 Z" + self.fmt + self.speedTerm(addspeed, feedzG0)) % (safez)) cx += xstep cy += ystep if stagger and iy % 2 == 0: cx = minx + xstep / 2 else: cx = minx if self.settings.annotate: self.gcode.append("(End object %s)" % self.viewTitle) self.gcl.updateList(self.gcode) self.setState(False, True) self.bVisualize.Enable() self.bSave.Enable()
def __init__(self, config): self.log_file = config.get('log_file') self.read_point = 0 self.regex = self._compile_regex() self.rotator = Rotator() self.storage = Storage()
file: interface.py """ from __future__ import absolute_import, print_function import os import signal import sys import serial from rotator import Rotator print('\nStarting interface.py') # Rotator setup rot = Rotator(23, 17, 22) rot.attach() print(' Rotator attached') rot.zero() # zero before doing anything homedir = os.environ['HOME'] ser = serial.Serial(port=homedir + '/.satcomm/ttySatR', baudrate=38400, timeout=0.5) print(' Serial port open') # SIGINT Handling def SIGINT_handler(sig, frame): """Gracefully exits from C-c.""" print('Releasing resources and exiting interface') rot.detach() # ser.close() sys.exit(0)
#!/usr/bin/env python3 """ Runs rotator calibration sequence author: Marion Anderson date: 2018-07-29 file: calib.py """ from __future__ import absolute_import, print_function from rotator import Rotator # Rotator setup rot = Rotator(23, 17, 22) rot.attach() rot.calibrate() # zero before doing anything