while log!= [CommProto.LOG, 1, CommProto.LOG_CRPT_MSG]: print 'Waiting for LOG message type 73 ...' log = recv(sock, COMMPROTO_MAX_MSG_SIZE) print 'Received: ', log print 'Good!' return True # Get default settings file SRC_ROOT = os.path.join(os.getcwd(), os.path.dirname(__file__), '..', 'src') SETTINGS_FILE = os.path.join(SRC_ROOT, 'settings', 'VisionSettings.py') # import helpers and settings file sys.path.append(SRC_ROOT) from helpers.Importer import Importer V_SETT = Importer.import_file(SETTINGS_FILE) V_SETT.LOG_FILE = os.path.join(os.path.dirname(V_SETT.__file__), V_SETT.LOG_FILE) # hack settings into __builtin__ so that other modules can access it __builtin__.V_SETT = V_SETT # import communication's protocol from communication.CommProto import CommProto port = ip = n = None request = [] i = 1 # strat from first argument, 0 argument is scprit's filename while i < len(sys.argv): if sys.argv[i] == '-s':
print "Waiting for LOG message type 73 ..." log = recv(sock, COMMPROTO_MAX_MSG_SIZE) print "Received: ", log print "Good!" return True # Get default settings file SRC_ROOT = os.path.join(os.getcwd(), os.path.dirname(__file__), "..", "src") SETTINGS_FILE = os.path.join(SRC_ROOT, "settings", "VisionSettings.py") # import helpers and settings file sys.path.append(SRC_ROOT) from helpers.Importer import Importer V_SETT = Importer.import_file(SETTINGS_FILE) V_SETT.LOG_FILE = os.path.join(os.path.dirname(V_SETT.__file__), V_SETT.LOG_FILE) # hack settings into __builtin__ so that other modules can access it __builtin__.V_SETT = V_SETT # import communication's protocol from communication.CommProto import CommProto port = ip = n = None request = [] i = 1 # strat from first argument, 0 argument is scprit's filename while i < len(sys.argv): if sys.argv[i] == "-s":
4 - binary image of region near yellow and blue robots --no-cam use an image instead of live camera feed N.B. In case '-s' is supplied to load a different configuration file, please note that relative path to settings_file.py will not work with symbolic links. Also, the name of settings_file.py must be changed to something different than VisionSettings.py, otherwise Python will load the default settings file. """) # append helpers package to PYTHONPATH so that each module from now on can # access ot it. SRC_ROOT = Importer.get_full_path_from_curr(os.path.dirname(__file__)) sys.path.append(os.path.join(SRC_ROOT, 'helpers')) # Default settings module, could be overriden by '-s' argument. SETTINGS_FILE = os.path.join(SRC_ROOT, 'settings', 'VisionSettings.py') USE_CAM = True DISPLAY_FEED = [] VISION_SRV_PORT = None BRIGHTNESS = None i = 1 while i < len(sys.argv): if sys.argv[i] == '-s': i += 1 # argument path is relative to dir of execution, so no changes needed SETTINGS_FILE = get_full_path_from_curr(sys.argv[i])