From 04b45d2d9bbd4ae8125ae2f70e26f8329453de8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Schr=C3=B6der?= <fschroeder@techfak.uni-bielefeld.de> Date: Wed, 14 Feb 2024 16:36:41 +0100 Subject: [PATCH] fix merge --- .../game_content/environment_config.yaml | 30 +++++++++---------- overcooked_simulator/game_server.py | 7 ----- overcooked_simulator/hooks.py | 2 ++ .../overcooked_environment.py | 4 +-- .../environment_config_rl.yaml | 8 ++--- 5 files changed, 23 insertions(+), 28 deletions(-) diff --git a/overcooked_simulator/game_content/environment_config.yaml b/overcooked_simulator/game_content/environment_config.yaml index 08241cc4..a0c14fcd 100644 --- a/overcooked_simulator/game_content/environment_config.yaml +++ b/overcooked_simulator/game_content/environment_config.yaml @@ -162,18 +162,18 @@ extra_setup_functions: callback_class_kwargs: log_path: USER_LOG_DIR/ENV_NAME/LOG_RECORD_NAME.jsonl add_hook_ref: true - info_msg: - func: !!python/name:overcooked_simulator.recording.class_recording_with_hooks '' - kwargs: - hooks: [ cutting_board_100 ] - log_class: !!python/name:overcooked_simulator.info_msg.InfoMsgManager '' - log_class_kwargs: - msg: Glückwunsch du hast was geschnitten! - fire_msg: - func: !!python/name:overcooked_simulator.recording.class_recording_with_hooks '' - kwargs: - hooks: [ new_fire ] - log_class: !!python/name:overcooked_simulator.info_msg.InfoMsgManager '' - log_class_kwargs: - msg: Feuer, Feuer, Feuer - level: Warning +# info_msg: +# func: !!python/name:overcooked_simulator.hooks.hooks_via_callback_class '' +# kwargs: +# hooks: [ cutting_board_100 ] +# log_class: !!python/name:overcooked_simulator.info_msg.InfoMsgManager '' +# log_class_kwargs: +# msg: Glückwunsch du hast was geschnitten! +# fire_msg: +# func: !!python/name:overcooked_simulator.hooks.hooks_via_callback_class '' +# kwargs: +# hooks: [ new_fire ] +# log_class: !!python/name:overcooked_simulator.info_msg.InfoMsgManager '' +# log_class_kwargs: +# msg: Feuer, Feuer, Feuer +# level: Warning diff --git a/overcooked_simulator/game_server.py b/overcooked_simulator/game_server.py index 8f7006db..84879915 100644 --- a/overcooked_simulator/game_server.py +++ b/overcooked_simulator/game_server.py @@ -432,13 +432,6 @@ class EnvironmentHandler: / 1_000_000_000 ) ) - - ( - grid, - player, - env_time, - orders, - ) = env_data.environment.get_vectorized_state("0") env_data.last_step_time = step_start if env_data.environment.game_ended: log.info(f"Env {env_id} ended. Set env to STOPPED.") diff --git a/overcooked_simulator/hooks.py b/overcooked_simulator/hooks.py index d53077ec..ed857857 100644 --- a/overcooked_simulator/hooks.py +++ b/overcooked_simulator/hooks.py @@ -111,6 +111,8 @@ NEW_FIRE = "new_fire" FIRE_SPREADING = "fire_spreading" +DROP_OFF_ON_COOKING_EQUIPMENT = "drop_off_on_cooking_equipment" + class Hooks: def __init__(self, env): diff --git a/overcooked_simulator/overcooked_environment.py b/overcooked_simulator/overcooked_environment.py index 9da0f8b8..7c504995 100644 --- a/overcooked_simulator/overcooked_environment.py +++ b/overcooked_simulator/overcooked_environment.py @@ -52,7 +52,7 @@ from overcooked_simulator.order import ( OrderConfig, ) from overcooked_simulator.player import Player, PlayerConfig -from overcooked_simulator.state_representation import StateRepresentation, InfoMsg +from overcooked_simulator.state_representation import InfoMsg from overcooked_simulator.utils import create_init_env_time, get_closest log = logging.getLogger(__name__) @@ -277,7 +277,7 @@ class Environment: self.counter_positions = np.array([c.pos for c in self.counters]) - self.order_and_score.create_init_orders(self.env_time) + self.order_manager.create_init_orders(self.env_time) self.start_time = self.env_time """The relative env time when it started.""" self.env_time_end = self.env_time + timedelta( diff --git a/overcooked_simulator/reinforcement_learning/environment_config_rl.yaml b/overcooked_simulator/reinforcement_learning/environment_config_rl.yaml index b6c9d3bc..6b9c6389 100644 --- a/overcooked_simulator/reinforcement_learning/environment_config_rl.yaml +++ b/overcooked_simulator/reinforcement_learning/environment_config_rl.yaml @@ -131,21 +131,21 @@ extra_setup_functions: callback_class_kwargs: static_score: 0.15 # json_states: - # func: !!python/name:overcooked_simulator.recording.class_recording_with_hooks '' + # func: !!python/name:overcooked_simulator.hooks.hooks_via_callback_class '' # kwargs: # hooks: [ json_state ] # log_class: !!python/name:overcooked_simulator.recording.LogRecorder '' # log_class_kwargs: # log_path: USER_LOG_DIR/ENV_NAME/json_states.jsonl # actions: -# func: !!python/name:overcooked_simulator.recording.class_recording_with_hooks '' +# func: !!python/name:overcooked_simulator.hooks.hooks_via_callback_class '' # kwargs: # hooks: [ pre_perform_action ] # log_class: !!python/name:overcooked_simulator.recording.LogRecorder '' # log_class_kwargs: # log_path: USER_LOG_DIR/ENV_NAME/LOG_RECORD_NAME.jsonl # random_env_events: -# func: !!python/name:overcooked_simulator.recording.class_recording_with_hooks '' +# func: !!python/name:overcooked_simulator.hooks.hooks_via_callback_class '' # kwargs: # hooks: [ order_duration_sample, plate_out_of_kitchen_time ] # log_class: !!python/name:overcooked_simulator.recording.LogRecorder '' @@ -153,7 +153,7 @@ extra_setup_functions: # log_path: USER_LOG_DIR/ENV_NAME/LOG_RECORD_NAME.jsonl # add_hook_ref: true # env_configs: -# func: !!python/name:overcooked_simulator.recording.class_recording_with_hooks '' +# func: !!python/name:overcooked_simulator.hooks.hooks_via_callback_class '' # kwargs: # hooks: [ env_initialized, item_info_config ] # log_class: !!python/name:overcooked_simulator.recording.LogRecorder '' -- GitLab