def __init__(self): Thread.__init__(self) self.vision_state = {} self.last = None self.go_forward = 0 self.stop = True self.distances = {229: 1280, 169: 1300, 162: 1320, 132: 1380, 113: 1500, 410: 2150}
def __init__(self, ): Thread.__init__(self) self.pipeline = rs.pipeline() self.config = rs.config() self.config.enable_stream(rs.stream.depth, 640, 480, rs.format.z16, 60) self.config.enable_stream(rs.stream.color, 640, 480, rs.format.bgr8, 60) self.frame = None try: dev = self.find_camera() advnc_mode = rs.rs400_advanced_mode(dev) while not advnc_mode.is_enabled(): advnc_mode.toggle_advanced_mode(True) time.sleep(2) # The 'dev' object will become invalid and we need to initialize it again dev = self.find_camera() advnc_mode = rs.rs400_advanced_mode(dev) with open('camera.json', 'r') as f: distros_dict = json.load(f) as_json_object = json.loads(str(distros_dict).replace("'", '\"')) json_string = str(as_json_object).replace("'", '\"') advnc_mode.load_json(json_string) except Exception as e: pass self.profile = self.pipeline.start(self.config)
def __init__(self): Thread.__init__(self) # Open serial port # self.serial = pyserial.open or something # Last command from AI, initially no command self.last_command = None
def __init__(self): Thread.__init__(self) ports = serial.tools.list_ports.comports() device = list(map(lambda port: port.device, ports))[0] self.ser = serial.Serial(device, 115200) self.speed_one = 0 self.speed_two = 0 self.speed_three = 0 self.thrower_speed = 1500 self.last_command = None self.go_forward = 0 self.locked = False
def __init__(self, name, delay=2): Thread.__init__(self, name, delay)
def __init__(self): Thread.__init__(self) # Initially vision state is unknown self.vision_state = {}