def setup(self, all_sprites): self.image = None self.zoomPoint = None self.preview = False self.timer = 0 # detect focus self.focus = ProcessFocus() self.focus.start() # stack images self.stack = ProcessStacking() self.stack.start() self.showStack = False # tracking images self.telescope = Telescope(self.config['telescope_dev']) self.tracker = ProcessTracking(self.telescope) self.tracker.start() self.tracking = False self.focusText = LcarsText((255,0,0), (17,303), "Focus: ") self.trackingText = LcarsText((255,0,0), (17,380), "Track: ") all_sprites.add(LcarsBackgroundImage("assets/jarvis.png")) all_sprites.add(self.focusText) all_sprites.add(self.trackingText)
class PiScopeProxy: def __init__(self): self.x_correction = 0 self.y_correction = 0 def setCorrection(self, x_correction, y_correction): self.x_correction = x_correction self.y_correction = y_correction cap = cv2.VideoCapture(p) ret, frame = cap.read() rows, cols = frame.shape[:2] piscope = PiScopeProxy() tracker = ProcessTracking(piscope) tracker.controllerX.SetKp(2.0) tracker.controllerX.SetKi(1.0) tracker.controllerY.SetKp(2.0) tracker.controllerY.SetKi(1.0) tracker.start() def now(): time.time() - time_origin def bump(x): if random.random() < x: return 1