def __init__(self, start_pose: np.matrix, sensor_angles, config: de2bot.DE2Config, beacons): state = de2bot.State(start_pose) self.angles = sensor_angles self.prev_controls = np.asmatrix([0, 0.]).T self.next_sense = 0 self.last_sense = None self.localization = Localizer(state, config, sensor_angles, beacons)
def load_localizer(params='/app/params'): src = os.path.join(params, 'params_localization') with open(os.path.join(src, 'post_config.json')) as file: data = json.load(file) localizer = Localizer(os.path.join(src, 'config.py'), os.path.join(src, 'weights.pth'), data['confidence_th']) return localizer
def __init__(self, working_dir, src, buggy, oracle, tests, golden, asserts, lines, build, configure, config): self.working_dir = working_dir self.config = config self.repair_test_suite = tests[:] self.validation_test_suite = tests[:] extracted = join(working_dir, 'extracted') os.mkdir(extracted) angelic_forest_file = join(working_dir, 'last-angelic-forest.json') tester = Tester(config, oracle, abspath(working_dir)) self.run_test = tester self.get_suspicious_groups = Localizer(config, lines) self.reduce = Reducer(config) if self.config['use_semfix_syn']: self.synthesize_fix = Semfix_Synthesizer(working_dir, config, extracted, angelic_forest_file) self.infer_spec = Semfix_Inferrer(working_dir, config, tester) else: self.synthesize_fix = Synthesizer(config, extracted, angelic_forest_file) self.infer_spec = Inferrer(config, tester, Load(working_dir)) self.instrument_for_localization = RepairableTransformer(config) self.instrument_for_inference = SuspiciousTransformer(config, extracted) self.apply_patch = FixInjector(config) validation_dir = join(working_dir, "validation") shutil.copytree(src, validation_dir, symlinks=True) self.validation_src = Validation(config, validation_dir, buggy, build, configure) self.validation_src.configure() compilation_db = self.validation_src.export_compilation_db() self.validation_src.import_compilation_db(compilation_db) self.validation_src.initialize() frontend_dir = join(working_dir, "frontend") shutil.copytree(src, frontend_dir, symlinks=True) self.frontend_src = Frontend(config, frontend_dir, buggy, build, configure) self.frontend_src.import_compilation_db(compilation_db) self.frontend_src.initialize() backend_dir = join(working_dir, "backend") shutil.copytree(src, backend_dir, symlinks=True) self.backend_src = Backend(config, backend_dir, buggy, build, configure) self.backend_src.import_compilation_db(compilation_db) self.backend_src.initialize() if golden is not None: golden_dir = join(working_dir, "golden") shutil.copytree(golden, golden_dir, symlinks=True) self.golden_src = Frontend(config, golden_dir, buggy, build, configure) self.golden_src.import_compilation_db(compilation_db) self.golden_src.initialize() else: self.golden_src = None self.dump = Dump(working_dir, asserts) self.trace = Trace(working_dir)
def __init__(self): self.target_identifier = TargetIdentifier() self.localizer = Localizer() self.bridge = CvBridge() self.sub_cam = rospy.Subscriber("/ardrone/bottom/image_raw", Image, self.identify_targets) self.sub_pos = rospy.Subscriber("/vicon/ARDroneCarre/ARDroneCarre", TransformStamped, self.store_pos) self.ob_locations = [] self.radius_list = [] self.lm_locations = [] self.crop_list = [] #self.yaw_list = [] self.epsilon = Duration(5) self.frames = 0 self.obstacle_frames = 0 self.landmark_frames = 0 self.not_pixels = 0 self.time_filtered = 0 return