def __init__(self, monitor, duration, cpu_core, plot): self.sleep_time = 0.03 self.monitor = monitor self.duration = duration self.plot = plot self.period = 0.05 # actuation period in seconds self.cpu_core = cpu_core if self.plot: self.graph = realTimePlot(self.duration, cpu_core, 0)
def __init__(self, controller, monitor, duration, cpu_core, target, plot): self.controller = controller self.monitor = monitor self.duration = duration self.plot = plot self.target = target self.controller.setCpu(self.monitor.getCpuLoad()) self.period = 0.05 # actuation period in seconds self.last_plot_time = time.time() self.start_time = time.time() if self.plot: self.graph = realTimePlot(self.duration, cpu_core, target)