Skip to content

Commit

Permalink
Add option to test initialization with custom positions
Browse files Browse the repository at this point in the history
  • Loading branch information
corentinlger committed Mar 20, 2024
1 parent b86da7a commit 225c5f6
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion scripts/run_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

def parse_args():
parser = argparse.ArgumentParser(description='Simulator Configuration')
parser.add_argument('--custom_pos', action='store_true', help='Just a test arg to wether use custom or random pos')
parser.add_argument('--box_size', type=float, default=100.0, help='Size of the simulation box')
parser.add_argument('--n_agents', type=int, default=10, help='Number of agents')
parser.add_argument('--n_objects', type=int, default=2, help='Number of objects')
Expand All @@ -35,6 +36,17 @@ def parse_args():

logging.basicConfig(level=args.log_level.upper())

# Define a custom list of init agents positions (ugly here but will be done in a yaml file later)
if args.custom_pos:
coord = 0
positions = []
# Here all the agents are placed on the box diagonal
for i in range(args.n_agents):
coord += 10
positions.append([coord, coord])
else:
positions = None

simulator_state = init_simulator_state(
box_size=args.box_size,
n_agents=args.n_agents,
Expand All @@ -51,7 +63,7 @@ def parse_args():

objects_state = init_object_state(simulator_state=simulator_state)

nve_state = init_nve_state(simulator_state=simulator_state)
nve_state = init_nve_state(simulator_state=simulator_state, agents_positions=positions)

state = init_state(
simulator_state=simulator_state,
Expand Down

0 comments on commit 225c5f6

Please sign in to comment.