type=str, default="default", help="architecture's name") args = parser.parse_args() agent_position, agent_velocity, leader_position, leader_velocity, \ atk_arch, def_arch, train_par, test_par, \ robustness_formula = get_settings(args.architecture, mode="test") pg = ParametersHyperparallelepiped(agent_position, agent_velocity, leader_position, leader_velocity) physical_model = model_platooning.Model(pg.sample(sigma=0.05)) attacker = architecture.Attacker(physical_model, *atk_arch.values()) defender = architecture.Defender(physical_model, *def_arch.values()) relpath = get_relpath(main_dir="platooning_" + args.architecture, train_params=train_par) load_models(attacker, defender, EXP + relpath) def run(mode=None): physical_model.initialize_random() conf_init = { 'x': physical_model.agent.x, 'dot_x': physical_model.agent.dot_x, 'theta': physical_model.agent.theta, 'dot_theta': physical_model.agent.dot_theta, }
dest="nfollowers", type=int, default=1, help="number of followers") parser.add_argument("--dark", default=False, action="store_true", help="Use dark theme") args = parser.parse_args() if args.dark: plt.style.use('./qb-common_dark.mplstyle') physical_model = model_platooning.Model(None) attacker = architecture.Attacker(physical_model, 2, 10, 2) defender = architecture.Defender(physical_model, 2, 10) misc.load_models(attacker, defender, args.dirname) dt = 0.05 steps = 300 def run(n_followers=1, mode=None): init_dist = random.uniform(1, 8) init_vel = random.uniform(1, 5) print(mode, 'd:', init_dist, 'v:', init_vel) leader = Leader(float(n_followers * init_dist), init_vel) followers = [ Follower(init_dist * (float(n_followers) - i - 1), init_vel)