import configs import configobj global config, enable config = configs.get_config('Obj Detection') enabled = config['enabled'] mc_name = config['micro_controller'] # Logging import logging log = logging.getLogger(config['logger_name']) # Events import events # Conditions from threading import Event # micro_controller_network import micro_controller_network mc = micro_controller_network.get_object(mc_name) # Static Variables return_codes = {'\x70':'Micro Switch Triggered', '\x71':'No Object', '\x72':'Can', '\x73':'Glass', '\x74':'Plastic', '\x75':'Detection Error', '\x76':'Start Button Pressed'} command_codes = {'Check Object':'\x60', 'Start Button Glow':'\x61'} # Static Functions # def init():
# Initialize modules # # Sabertooth2x10 import sabertooth2x10 as saber saber.init() mc = saber.get_object() # Laser Range Finder import laser laser.init() lrf = laser.get_object() lrf.clear() # MCN import micro_controller_network as mcn mcn.init() micros = [] servo_micro = mcn.get_object('Servo Control') micros.append(servo_micro) od_micro = mcn.get_object('Obj Detection') micros.append(od_micro) array_micro = mcn.get_object('Array Micro') micros.append(array_micro) # Servo Controller import servo_controller as sc sc.init() arm_servo = sc.get_object('Arm Servo') arm_down() sorter_servo = sc.get_object('Sorter Servo') sorter_center() gripper_servo = sc.get_object('Gripper Servo') gripper_close() spinner_servo = sc.get_object('Spinner Servo')