Skip to content

Commit

Permalink
Update scripts with new init fn
Browse files Browse the repository at this point in the history
  • Loading branch information
corentinlger committed Apr 24, 2024
1 parent 82746bd commit 5c4cf2b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 42 deletions.
21 changes: 1 addition & 20 deletions scripts/run_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
from omegaconf import DictConfig, OmegaConf

from vivarium.simulator import behaviors
from vivarium.simulator.states import init_simulator_state
from vivarium.simulator.states import init_agent_state
from vivarium.simulator.states import init_object_state
from vivarium.simulator.states import init_entities_state
from vivarium.simulator.states import init_state
from vivarium.simulator.simulator import Simulator
from vivarium.simulator.physics_engine import dynamics_rigid
Expand All @@ -20,22 +16,7 @@ def main(cfg: DictConfig = None) -> None:
logging.basicConfig(level=cfg.log_level)

args = OmegaConf.merge(cfg.default, cfg.scene)

simulator_state = init_simulator_state(**args.simulator)

agents_state = init_agent_state(simulator_state=simulator_state, **args.agents)

objects_state = init_object_state(simulator_state=simulator_state, **args.objects)

entities_state = init_entities_state(simulator_state=simulator_state, **args.entities)

state = init_state(
simulator_state=simulator_state,
agents_state=agents_state,
objects_state=objects_state,
entities_state=entities_state
)

state = init_state(args)
simulator = Simulator(state, behaviors.behavior_bank, dynamics_rigid)

lg.info('Simulator server started')
Expand Down
23 changes: 1 addition & 22 deletions scripts/run_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
from omegaconf import DictConfig, OmegaConf

from vivarium.simulator import behaviors
from vivarium.simulator.states import init_simulator_state
from vivarium.simulator.states import init_agent_state
from vivarium.simulator.states import init_object_state
from vivarium.simulator.states import init_entities_state
from vivarium.simulator.states import init_state
from vivarium.simulator.simulator import Simulator
from vivarium.simulator.physics_engine import dynamics_rigid
Expand All @@ -19,28 +15,11 @@ def main(cfg: DictConfig = None) -> None:
logging.basicConfig(level=cfg.log_level)

args = OmegaConf.merge(cfg.default, cfg.scene)

simulator_state = init_simulator_state(**args.simulator)

agents_state = init_agent_state(simulator_state=simulator_state, **args.agents)

objects_state = init_object_state(simulator_state=simulator_state, **args.objects)

entities_state = init_entities_state(simulator_state=simulator_state, **args.entities)

state = init_state(
simulator_state=simulator_state,
agents_state=agents_state,
objects_state=objects_state,
entities_state=entities_state
)

state = init_state(args)
simulator = Simulator(state, behaviors.behavior_bank, dynamics_rigid)

lg.info("Running simulation")

simulator.run(threaded=False, num_steps=cfg.num_steps)

lg.info("Simulation complete")

if __name__ == "__main__":
Expand Down

0 comments on commit 5c4cf2b

Please sign in to comment.